/* ===== 全局样式 - 简约高雅 ===== */
@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@300;400;500;600&family=Noto+Serif+SC:wght@300;400;500;600&family=Inter:wght@300;400;500&display=swap');

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #FAFAF8;
  --bg-warm: #F5F4F0;
  --text-primary: #1A1A1A;
  --text-secondary: #6B6B6B;
  --text-muted: #999999;
  --accent: #8B7355;
  --accent-light: #C4A882;
  --border: #E8E6E1;
  --card-bg: #FFFFFF;
  --shadow: rgba(0, 0, 0, 0.04);
  --shadow-hover: rgba(0, 0, 0, 0.08);
}

body {
  font-family: 'Inter', 'Noto Serif SC', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ===== 页面切换 ===== */
.page {
  display: none;
  min-height: 100vh;
  animation: fadeIn 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.page.active {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* 相册页需要特殊处理 */
#album.active {
  display: flex;
  flex-direction: column;
  align-items: center;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ===== 通用标签 ===== */
.section-label {
  font-family: 'Inter', sans-serif;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.3em;
  color: var(--text-muted);
  text-transform: uppercase;
}

/* ===== 封面页 - 星空主题 ===== */
#cover {
  justify-content: center;
  background: radial-gradient(ellipse at center, #0a0a1a 0%, #000000 100%);
  text-align: center;
  position: relative;
  overflow: hidden;
}

#starfield {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

.cover-content {
  position: relative;
  z-index: 1;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  animation: fadeInUp 1.5s ease-out;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.cover-title {
  font-family: 'Permanent Marker', cursive;
  font-size: 3.5rem;
  font-weight: 400;
  color: #fff;
  letter-spacing: 0.05em;
  line-height: 1.2;
  /* 手绘笔刷 + 3D 浮雕效果 */
  text-shadow:
    3px 3px 0 rgba(0, 0, 0, 0.3),
    6px 6px 0 rgba(0, 0, 0, 0.15),
    0 0 30px rgba(138, 180, 248, 0.3),
    0 0 60px rgba(138, 180, 248, 0.15);
  animation: titleFloat 4s ease-in-out infinite alternate;
}

@keyframes titleFloat {
  from {
    transform: translateY(0);
    text-shadow:
      3px 3px 0 rgba(0, 0, 0, 0.3),
      6px 6px 0 rgba(0, 0, 0, 0.15),
      0 0 30px rgba(138, 180, 248, 0.3),
      0 0 60px rgba(138, 180, 248, 0.15);
  }
  to {
    transform: translateY(-4px);
    text-shadow:
      4px 4px 0 rgba(0, 0, 0, 0.35),
      8px 8px 0 rgba(0, 0, 0, 0.18),
      0 0 40px rgba(138, 180, 248, 0.4),
      0 0 80px rgba(138, 180, 248, 0.2);
  }
}

.cover-subtitle {
  font-family: 'Inter', sans-serif;
  font-size: 0.75rem;
  font-weight: 300;
  color: rgba(255, 255, 255, 0.5);
  letter-spacing: 0.4em;
  text-transform: uppercase;
  animation: subtitleFade 2s ease-out 0.5s both;
}

@keyframes subtitleFade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.enter-btn {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1rem;
  font-weight: 400;
  font-style: italic;
  padding: 12px 40px;
  background: transparent;
  color: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.3);
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  letter-spacing: 0.15em;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  animation: btnFade 2s ease-out 1s both;
}

@keyframes btnFade {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.enter-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.6);
  color: #fff;
  transform: scale(1.05);
  box-shadow: 
    0 0 20px rgba(138, 180, 248, 0.4),
    0 0 40px rgba(138, 180, 248, 0.2);
}

/* ===== 侧边栏 ===== */
.sidebar {
  position: fixed;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 12px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--border);
  border-radius: 0 12px 12px 0;
  z-index: 100;
  box-shadow: 4px 0 20px rgba(0, 0, 0, 0.04);
}

.sidebar-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 52px;
  height: 52px;
  background: transparent;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  color: var(--text-secondary);
}

.sidebar-btn svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.sidebar-btn span {
  font-family: 'Inter', sans-serif;
  font-size: 0.6rem;
  font-weight: 400;
  letter-spacing: 0.02em;
}

.sidebar-btn:hover {
  background: var(--bg-warm);
  color: var(--text-primary);
  transform: scale(1.05);
}

.sidebar-btn:active {
  transform: scale(0.95);
}

.sidebar-divider {
  width: 24px;
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

/* ===== 胶卷装饰条 ===== */
.film-strip {
  position: absolute;
  left: 0;
  width: 100%;
  height: 44px;
  background: #1c1c1c;
  z-index: 10;
  display: flex;
  align-items: center;
  overflow: hidden;
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.22);
}

.film-strip-top {
  top: 0;
}

.film-strip-bottom {
  bottom: 0;
}

/* 齿孔用伪元素实现 */
.film-holes {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
}

.film-holes::before,
.film-holes::after {
  content: '';
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  height: 22px;
  background-image: repeating-linear-gradient(
    90deg,
    #000 0px,
    #000 14px,
    transparent 14px,
    transparent 30px
  );
  border-radius: 3px;
}

.film-holes::before {
  left: 0;
  width: calc(50% - 60px);
}

.film-holes::after {
  right: 0;
  width: calc(50% - 60px);
}

/* 帧计数器 */
.film-counter {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  background: #1c1c1c;
  padding: 0 18px;
  display: flex;
  align-items: center;
  height: 100%;
}

.film-counter-inner {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.28em;
  color: rgba(255, 215, 100, 0.82);
  white-space: nowrap;
}

/* ===== 照片轨道页面 ===== */
.photo-track {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: linear-gradient(180deg, #f0eeea 0%, #f8f7f4 100%);
  padding-top: 44px;
  padding-bottom: 44px;
}

.track-container {
  position: relative;
  width: 100vw;
  height: 500px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}

.track-container:active {
  cursor: grabbing;
}

.track-photo {
  position: absolute;
  left: 0;
  top: 50%;
  margin-top: -100px;
  width: 200px;
  height: 200px;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  transition: box-shadow 0.3s ease, filter 0.3s ease;
  cursor: pointer;
  background: #fff;
  padding: 3px;
  will-change: transform, opacity;
}

.track-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 4px;
  transition: transform 0.4s ease;
}

.track-photo:hover {
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  filter: brightness(1.05);
}

.track-photo:hover img {
  transform: scale(1.05);
}

.track-info {
  margin-top: 40px;
  text-align: center;
}

.track-info span {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.2rem;
  font-weight: 400;
  font-style: italic;
  color: var(--text-muted);
  letter-spacing: 0.2em;
}

/* 自动播放动画 */
@keyframes trackRotate {
  0% {
    transform: rotateY(0deg);
  }
  100% {
    transform: rotateY(360deg);
  }
}

/* ===== 照片详情页 - 重构版 ===== */
.photo-detail {
  position: fixed;
  top: 0;
  left: 76px; /* 侧边栏宽度 */
  right: 0;
  bottom: 0;
  background: var(--bg);
  z-index: 50;
  display: flex;
  flex-direction: row;
  animation: fadeIn 0.4s ease;
}

/* ── 左侧信息面板 ── */
.detail-panel {
  width: 260px;
  flex-shrink: 0;
  height: 100%;
  border-right: 1px solid var(--border);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  padding: 32px 28px;
  gap: 0;
  overflow-y: auto;
}

.detail-panel-badge {
  font-family: 'Inter', sans-serif;
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.25em;
  color: var(--text-muted);
  text-transform: uppercase;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 20px;
  width: fit-content;
  margin-bottom: 32px;
}

.detail-meta-section {
  margin-bottom: 28px;
}

.detail-meta-label {
  font-family: 'Inter', sans-serif;
  font-size: 0.6rem;
  font-weight: 500;
  letter-spacing: 0.3em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 8px;
}

/* 日期 - 大号可编辑 */
.detail-date-value {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.7rem;
  font-weight: 400;
  color: var(--text-primary);
  letter-spacing: 0.02em;
  line-height: 1.2;
  cursor: pointer;
  transition: color 0.2s ease;
  min-height: 2rem;
  outline: none;
  border-bottom: 1px solid transparent;
}

.detail-date-value:hover,
.detail-date-value.editing {
  color: var(--accent);
  border-bottom-color: var(--accent-light);
}

.detail-date-value[contenteditable="true"]:focus {
  color: var(--text-primary);
  border-bottom-color: var(--accent);
}

/* 星期 */
.detail-weekday {
  font-family: 'Cormorant Garamond', serif;
  font-size: 0.9rem;
  font-weight: 400;
  font-style: italic;
  color: var(--accent-light);
  margin-top: 3px;
  min-height: 1.2em;
}

/* Location */
.detail-location-value {
  font-family: 'Inter', sans-serif;
  font-size: 0.82rem;
  font-weight: 300;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color 0.2s ease;
  min-height: 1.4rem;
  outline: none;
  border-bottom: 1px solid transparent;
  padding-bottom: 2px;
  line-height: 1.5;
}

.detail-location-value.empty {
  color: var(--text-muted);
  font-style: italic;
}

.detail-location-value:hover,
.detail-location-value.editing {
  color: var(--text-primary);
  border-bottom-color: var(--border);
}

.detail-location-value[contenteditable="true"]:focus {
  border-bottom-color: var(--accent);
  color: var(--text-primary);
}

/* 分隔线 */
.detail-divider {
  width: 100%;
  height: 1px;
  background: var(--border);
  margin: 4px 0 28px;
}

/* Preview 缩略图 */
.detail-preview-section {
  flex: 1;
}

.detail-previews {
  display: flex;
  gap: 10px;
  margin-top: 2px;
}

.detail-preview-thumb {
  width: 88px;
  height: 88px;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  position: relative;
  transition: all 0.25s ease;
  background: var(--bg-warm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.detail-preview-thumb:hover {
  border-color: var(--text-secondary);
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
  transform: translateY(-2px);
}

.detail-preview-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.detail-preview-thumb img[src=""] {
  display: none;
}

.preview-empty-hint {
  position: absolute;
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.2rem;
  color: var(--border);
}

.detail-preview-thumb:has(img[src=""]) .preview-empty-hint,
.detail-preview-thumb.no-image .preview-empty-hint {
  display: flex;
}

/* ── 右侧主内容区 ── */
.detail-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

/* 主图 + 评论区 */
.detail-photo-zone {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 20px 36px 8px;
  /* 必须设置 min-height:0 才能让 flex 子元素正确收缩 */
  min-height: 0;
}

.detail-photo-zone > img#detailImg {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  border-radius: 4px;
  box-shadow: 0 8px 48px rgba(0,0,0,0.12);
  transition: opacity 0.4s ease;
  position: relative;
  z-index: 1;
}

/* 评论引导提示 */
.comment-nudge {
  position: absolute;
  bottom: 16px;
  right: 16px;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px dashed rgba(160, 140, 120, 0.45);
  border-radius: 20px;
  padding: 6px 12px 6px 8px;
  font-size: 11px;
  color: var(--text-muted);
  font-family: 'Noto Serif SC', serif;
  pointer-events: none;
  animation: nudgeBounce 3s ease-in-out infinite;
  transition: opacity 0.4s ease;
}

.comment-nudge.hidden {
  opacity: 0;
  pointer-events: none;
}

.comment-nudge-icon {
  font-size: 14px;
  line-height: 1;
  animation: nudgePen 2.5s ease-in-out infinite;
}

@keyframes nudgeBounce {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-4px); }
}

@keyframes nudgePen {
  0%, 80%, 100% { transform: rotate(0deg); }
  40%           { transform: rotate(-15deg); }
}

/* 评论气泡 - 浮动在图片周围 */
.photo-comment-bubble {
  position: absolute;
  z-index: 5;
  max-width: 200px;
  animation: bubbleIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  opacity: 0;
  cursor: default;
}

.photo-comment-bubble:hover {
  z-index: 20;
}

.photo-comment-bubble:hover .comment-delete {
  opacity: 1;
}

@keyframes bubbleIn {
  from { opacity: 0; transform: scale(0.85); }
  to   { opacity: 1; transform: scale(1); }
}

.bubble-inner {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.6);
  border-radius: 14px;
  padding: 10px 14px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.1);
  font-family: 'Cormorant Garamond', 'Noto Serif SC', serif;
  font-size: 0.95rem;
  font-style: italic;
  line-height: 1.5;
  letter-spacing: 0.05em;
}

/* ── 底部控制栏 ── */
.detail-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 10px 36px;
  flex-shrink: 0;
}

.detail-nav-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s ease;
  flex-shrink: 0;
}

.detail-nav-btn:hover {
  border-color: var(--text-primary);
  color: var(--text-primary);
  background: var(--bg-warm);
}

.detail-nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.detail-back-btn {
  font-family: 'Inter', sans-serif;
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 8px 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.25s ease;
}

.detail-back-btn:hover {
  color: var(--text-primary);
  border-color: var(--text-primary);
  background: var(--bg-warm);
}

/* ── 进度条 ── */
.detail-progress-bar {
  padding: 8px 36px 20px;
  flex-shrink: 0;
}

.detail-progress-label {
  font-family: 'Inter', sans-serif;
  font-size: 0.6rem;
  font-weight: 500;
  letter-spacing: 0.25em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 8px;
}

.detail-progress-track {
  display: flex;
  align-items: center;
  gap: 0;
  position: relative;
  height: 24px;
}

/* 进度条底线 */
.detail-progress-track::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 1px;
  background: var(--border);
}

.progress-node {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--bg);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  z-index: 1;
  flex-shrink: 0;
}

.progress-node:hover {
  border-color: var(--accent-light);
  transform: scale(1.4);
}

.progress-node.active {
  background: var(--text-primary);
  border-color: var(--text-primary);
  transform: scale(1.3);
}

.detail-progress-hint {
  font-family: 'Inter', sans-serif;
  font-size: 0.62rem;
  color: var(--text-muted);
  margin-top: 6px;
  letter-spacing: 0.05em;
  text-align: right;
}

/* ── 上传面板扩展字段 ── */
.upload-meta-fields {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.upload-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.upload-field-label {
  font-family: 'Inter', sans-serif;
  font-size: 0.6rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  color: var(--text-muted);
  text-transform: uppercase;
}

.upload-field-label span {
  font-weight: 300;
  letter-spacing: 0.05em;
  text-transform: none;
  color: var(--text-muted);
  opacity: 0.7;
  margin-left: 4px;
}

.upload-field input {
  font-family: 'Inter', sans-serif;
  font-size: 0.8rem;
  font-weight: 300;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.2s ease;
}

.upload-field input:focus {
  border-color: var(--accent-light);
}

.upload-field input::placeholder {
  color: var(--text-muted);
  font-style: italic;
}

/* 上传面板完成按钮 */
.upload-confirm-btn {
  width: 100%;
  margin-top: 14px;
  font-family: 'Inter', sans-serif;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 10px 0;
  background: var(--text-primary);
  color: var(--bg);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.upload-confirm-btn:hover {
  opacity: 0.8;
}

.upload-confirm-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}



.album-header {
  text-align: center;
  margin-bottom: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.page-indicator {
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0.1em;
}

/* 照片容器 */
.photo-container {
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  position: relative;
  min-height: 400px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.photo-page {
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 0;
  min-height: 400px;
}

/* 评论区域 - 上方和下方 */
.comments-area {
  width: 100%;
  max-width: 95vw;
  min-height: 80px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 16px 32px;
  padding: 12px 20px;
}

.comments-area.top {
  align-items: flex-end;
}

.comments-area.bottom {
  align-items: flex-start;
}

/* 照片包裹层 */
.photo-wrapper {
  position: relative;
  width: 100%;
  max-width: 95vw;
  display: flex;
  align-items: center;
  justify-content: center;
}

.photo-page img {
  width: 100%;
  height: auto;
  max-height: 75vh;
  object-fit: contain;
  display: block;
  transition: opacity 0.5s ease;
}

/* 漂浮评论 - 艺术字风格 */
.floating-comment {
  position: relative;
  transform: rotate(var(--rotation, 0deg));
  animation: floatIn 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  opacity: 0;
  cursor: default;
  pointer-events: auto;
  max-width: 220px;
}

.floating-comment:hover {
  z-index: 20;
}

.floating-comment:hover .comment-delete {
  opacity: 1;
}

@keyframes floatIn {
  from {
    opacity: 0;
    transform: rotate(var(--rotation, 0deg)) translateY(10px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: rotate(var(--rotation, 0deg)) translateY(0) scale(1);
  }
}

/* 评论文字 - 无边框艺术字 */
.floating-comment .comment-text {
  font-family: 'Cormorant Garamond', 'Noto Serif SC', serif;
  font-size: 1.1rem;
  font-weight: 400;
  font-style: italic;
  letter-spacing: 0.1em;
  padding: 4px 8px;
  transition: all 0.3s ease;
  animation: gentleFloat 4s ease-in-out infinite;
  animation-delay: var(--float-delay, 0s);
  text-align: center;
  display: inline-block;
}

@keyframes gentleFloat {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-3px);
  }
}

.floating-comment:hover .comment-text {
  opacity: 0.8;
}

/* 删除按钮 */
.comment-delete {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--text-primary);
  color: var(--bg);
  border: none;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.comment-delete:hover {
  background: #c0392b;
  transform: scale(1.1);
}

/* 添加评论按钮 */
.add-comment-btn {
  font-family: 'Inter', sans-serif;
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border);
  padding: 6px 16px;
  margin-top: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  letter-spacing: 0.05em;
}

.add-comment-btn:hover {
  color: var(--text-primary);
  border-color: var(--text-primary);
}

/* 照片日期 - 页面右上角，倾斜摆放 */
.photo-date-container {
  position: absolute;
  top: 40px;
  right: 40px;
  z-index: 60;
}

.photo-detail .photo-date-container {
  top: 50px;
  right: 60px;
}

.photo-date {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.5rem;
  font-weight: 400;
  font-style: italic;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 8px 16px;
  transform: rotate(-12deg);
  transform-origin: center center;
}

.photo-date:hover {
  color: var(--text-primary);
  transform: rotate(-12deg) scale(1.05);
}

.photo-date.has-date {
  color: var(--text-secondary);
  font-weight: 500;
}

.page-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 6;
  opacity: 0;
  transition: opacity 0.5s ease;
  background: var(--bg);
}

.page-overlay.show {
  opacity: 1;
}

/* 空状态 */
.empty-state {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--text-muted);
}

.empty-state p {
  font-size: 0.9rem;
  font-weight: 300;
}

/* 导航控制 */
.nav-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  margin: 2rem 0;
}

.nav-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.3s ease;
}

.nav-btn:hover {
  color: var(--text-primary);
  border-color: var(--text-primary);
}

.nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.nav-dots {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
}

.nav-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--border);
  cursor: pointer;
  transition: all 0.3s ease;
}

.nav-dot.active {
  background: var(--text-primary);
}

/* 上传区域 - 侧边栏弹窗 */
.upload-panel {
  position: fixed;
  left: 80px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.12);
  z-index: 99;
  display: none;
  width: 260px;
}

.upload-panel.show {
  display: block;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-50%) translateX(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
  }
}

.upload-area {
  padding: 2rem 1.5rem;
  border: 1px dashed var(--border);
  border-radius: 8px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  transition: all 0.3s ease;
  cursor: pointer;
}

.upload-area:hover,
.upload-area.dragover {
  border-color: var(--text-secondary);
  background: var(--bg-warm);
}

.upload-area input[type="file"] {
  display: none;
}

/* ===== 留言页 ===== */
#messages {
  background: var(--bg);
  min-height: 100vh;
  width: 100%;
  padding: 0;
  display: none;
  align-items: unset !important;
}

#messages.active {
  display: block !important;
}

/* 信封墙整体布局 */
.envelope-wall {
  padding-left: 80px; /* 侧边栏宽度 */
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.envelope-wall-header {
  text-align: center;
  padding: 3rem 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.envelope-wall-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem;
  gap: 1rem;
}

.messages-subtitle {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 300;
}

/* 信封网格 */
.envelope-grid {
  flex: 1;
  padding: 1.5rem 2.5rem 2rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 36px;
  align-content: start;
}

/* ── 单个信封 ── */
.envelope-grid.message-timeline {
  display: block;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 1rem 32px 3rem;
}

.timeline-day {
  position: relative;
  margin: 24px 0 0;
  padding: 12px 0 22px 120px;
  font-size: 1.15rem;
  font-weight: 500;
  letter-spacing: 0.06em;
}

.timeline-day span {
  display: block;
  margin-top: 5px;
  font-size: 0.65rem;
  font-weight: 400;
  color: var(--text-muted);
}

.timeline-entry {
  position: relative;
  display: grid;
  grid-template-columns: 88px minmax(0, 340px);
  gap: 32px;
  padding-bottom: 32px;
}

.timeline-entry::before {
  content: '';
  position: absolute;
  left: 103px;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--border);
}

.timeline-entry::after {
  content: '';
  position: absolute;
  left: 99px;
  top: 17px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--text-muted);
}

.timeline-time {
  padding-top: 12px;
  text-align: right;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.message-timeline .envelope-card {
  border: 0;
  padding: 0;
  background: transparent;
  font: inherit;
}

.message-timeline .envelope-card:focus-visible {
  outline: 2px solid var(--text-muted);
  outline-offset: 6px;
  border-radius: 6px;
}

.message-timeline .envelope-body {
  overflow: hidden;
}

@media (max-width: 600px) {
  .envelope-grid.message-timeline { padding: 0 16px 2rem; }
  .timeline-day { padding-left: 80px; font-size: 1rem; }
  .timeline-entry { grid-template-columns: 60px minmax(0, 1fr); gap: 20px; padding-bottom: 24px; }
  .timeline-entry::before { left: 69px; }
  .timeline-entry::after { left: 65px; }
  .timeline-time { font-size: 0.68rem; }
}

.envelope-card {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 2;
  cursor: pointer;
  perspective: 600px;
  animation: envFadeIn 0.5s ease both;
}

@keyframes envFadeIn {
  from { opacity: 0; transform: translateY(16px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* 信封本体 */
.envelope-body {
  position: absolute;
  inset: 0;
  border-radius: 6px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08), 0 1px 4px rgba(0,0,0,0.04);
  transition: box-shadow 0.3s ease, transform 0.3s ease;
  overflow: visible;
  pointer-events: none;
}

.envelope-card:hover .envelope-body,
.envelope-card.opening .envelope-body {
  box-shadow: 0 12px 40px rgba(0,0,0,0.14), 0 2px 8px rgba(0,0,0,0.06);
  transform: translateY(-4px);
}

/* 信封底色（纸质感） */
.envelope-bg {
  position: absolute;
  inset: 0;
  border-radius: 6px;
  overflow: hidden;
  pointer-events: none;
}

/* 信封底部两侧斜角 */
.envelope-bg::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 55%;
  background: inherit;
  clip-path: polygon(0 100%, 50% 0%, 100% 100%);
  opacity: 0.55;
  filter: brightness(0.88);
}

/* 左侧折角 */
.envelope-bg::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 51%;
  height: 55%;
  clip-path: polygon(0 0, 0 100%, 100% 100%);
  background: inherit;
  opacity: 0.35;
  filter: brightness(0.82);
}

/* 右侧折角（用额外元素） */
.envelope-fold-right {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 51%;
  height: 55%;
  border-radius: 0 0 6px 0;
  clip-path: polygon(0 100%, 100% 0, 100% 100%);
  opacity: 0.35;
  filter: brightness(0.82);
  pointer-events: none;
}

/* 信封盖（翻盖，打开动画） */
.envelope-flap {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 54%;
  transform-origin: top center;
  transform: rotateX(0deg);
  transition: transform 0.45s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 3;
  border-radius: 6px 6px 0 0;
  overflow: hidden;
  pointer-events: none; /* 翻盖不拦截点击事件 */
}

/* 信封盖斜角（倒 V 形） */
.envelope-flap::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 100%;
  clip-path: polygon(0 0, 50% 100%, 100% 0);
  background: inherit;
  filter: brightness(0.9);
}

/* 悬停 / 点击打开时盖子翻开 */
.envelope-card:hover .envelope-flap,
.envelope-card.opening .envelope-flap {
  transform: rotateX(-160deg);
}

/* 信封内部露出的信纸 */
.envelope-letter {
  position: absolute;
  left: 10%;
  right: 10%;
  bottom: 8%;
  height: 52%;
  background: #fffdf8;
  border-radius: 3px;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.06);
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  gap: 3px;
  transition: transform 0.45s cubic-bezier(0.4, 0, 0.2, 1) 0.1s;
  overflow: hidden;
}

.envelope-card:hover .envelope-letter,
.envelope-card.opening .envelope-letter {
  transform: translateY(-18%);
}

/* 信纸上的横线装饰 */
.envelope-letter::before {
  content: '';
  position: absolute;
  left: 14%;
  right: 14%;
  top: 28%;
  height: 1px;
  background: rgba(0,0,0,0.06);
  box-shadow: 0 8px 0 rgba(0,0,0,0.04), 0 16px 0 rgba(0,0,0,0.03);
}

/* 信纸上的头像 */
.env-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 600;
  color: #fff;
  margin-bottom: 5px;
  flex-shrink: 0;
}

/* 信纸上的名字 */
.env-name {
  font-family: 'Cormorant Garamond', 'Noto Serif SC', serif;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: 0.06em;
  text-align: center;
  line-height: 1.3;
  max-width: 100%;
  word-break: break-word;
  white-space: normal;
}

.env-count {
  font-family: 'Inter', sans-serif;
  font-size: 0.6rem;
  font-weight: 300;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  margin-top: 2px;
}

/* 信封封口邮戳装饰 */
.envelope-stamp {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 22px;
  height: 26px;
  border: 1.5px solid rgba(255,255,255,0.5);
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 4;
  opacity: 0.7;
  pointer-events: none;
}

.envelope-stamp::before {
  content: '';
  position: absolute;
  inset: 3px;
  background: rgba(255,255,255,0.3);
  border-radius: 1px;
}

/* 信封蜡封圆点 */
.envelope-seal {
  position: absolute;
  bottom: calc(54% - 7px);
  left: 50%;
  transform: translateX(-50%);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  z-index: 4;
  background: rgba(255,255,255,0.6);
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
  transition: transform 0.45s ease, opacity 0.3s ease;
  pointer-events: none;
}

.envelope-card:hover .envelope-seal {
  opacity: 0;
  transform: translateX(-50%) scale(0.5);
}

/* 留言表单 */
.message-form {
  width: 100%;
  max-width: 500px;
  margin: 0 auto 2rem;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 24px;
  background: var(--card-bg);
  border: 1px solid var(--border);
}

.message-form input,
.message-form textarea {
  font-family: 'Inter', sans-serif;
  padding: 12px 16px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 300;
  outline: none;
  transition: border-color 0.3s ease;
}

.message-form input:focus,
.message-form textarea:focus {
  border-color: var(--text-primary);
}

.message-form .passcode-set-input {
  font-size: 0.82rem;
  letter-spacing: 0.02em;
}

.message-form .passcode-set-input::placeholder {
  font-size: 0.78rem;
}

.message-form textarea {
  min-height: 100px;
  resize: vertical;
}

/* 留言类型选择器 */
.msg-type-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.msg-type-label {
  font-family: 'Inter', sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  white-space: nowrap;
  text-transform: uppercase;
}

.msg-type-tabs {
  display: flex;
  gap: 0;
  border: 1px solid var(--border);
}

.msg-type-tab {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: 'Inter', sans-serif;
  font-size: 0.78rem;
  font-weight: 400;
  padding: 7px 14px;
  background: transparent;
  color: var(--text-secondary);
  border: none;
  border-right: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s ease;
  letter-spacing: 0.03em;
}

.msg-type-tab:last-child {
  border-right: none;
}

.msg-type-tab.active {
  background: var(--text-primary);
  color: var(--bg);
}

.msg-type-tab:not(.active):hover {
  background: var(--bg-warm);
  color: var(--text-primary);
}

/* 录音组件 */
.voice-recorder {
  border: 1px solid var(--border);
  background: var(--bg);
  padding: 20px 18px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.recorder-status {
  font-family: 'Inter', sans-serif;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  text-transform: uppercase;
}

.recorder-timer {
  font-family: 'Cormorant Garamond', serif;
  font-size: 2rem;
  font-weight: 300;
  color: var(--text-primary);
  letter-spacing: 0.1em;
  line-height: 1;
}

/* 录音中波形动画 */
.recorder-waveform {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 28px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.recorder-waveform.active {
  opacity: 1;
}

.recorder-waveform span {
  display: block;
  width: 3px;
  background: var(--text-secondary);
  border-radius: 2px;
  animation: waveBar 0.8s ease-in-out infinite;
  height: 6px;
}

.recorder-waveform span:nth-child(1) { animation-delay: 0.0s; }
.recorder-waveform span:nth-child(2) { animation-delay: 0.1s; }
.recorder-waveform span:nth-child(3) { animation-delay: 0.2s; }
.recorder-waveform span:nth-child(4) { animation-delay: 0.3s; }
.recorder-waveform span:nth-child(5) { animation-delay: 0.4s; }
.recorder-waveform span:nth-child(6) { animation-delay: 0.3s; }
.recorder-waveform span:nth-child(7) { animation-delay: 0.2s; }
.recorder-waveform span:nth-child(8) { animation-delay: 0.1s; }
.recorder-waveform span:nth-child(9) { animation-delay: 0.05s; }
.recorder-waveform span:nth-child(10) { animation-delay: 0.0s; }

@keyframes waveBar {
  0%, 100% { height: 4px; opacity: 0.4; }
  50%       { height: 24px; opacity: 1; }
}

.recorder-btns {
  display: flex;
  gap: 14px;
  align-items: center;
}

.recorder-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.recorder-btn:hover {
  background: var(--text-primary);
  color: var(--bg);
  border-color: var(--text-primary);
}

.recorder-btn-start {
  color: #C06060;
  border-color: #C06060;
}

.recorder-btn-start:hover {
  background: #C06060;
  border-color: #C06060;
  color: #fff;
}

.recorder-btn-stop {
  color: #C06060;
  border-color: #C06060;
}

.recorder-btn-stop:hover {
  background: #C06060;
  border-color: #C06060;
  color: #fff;
}

.recorder-preview {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.recorder-preview-hint {
  font-family: 'Inter', sans-serif;
  font-size: 0.72rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

/* 信纸内语音播放器 */
.letter-voice-player {
  margin: 1rem 0 0.5rem;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(0,0,0,0.03);
  border-left: 2px solid #C4A882;
}

.letter-voice-play-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1.5px solid #C4A882;
  background: transparent;
  color: #8B7355;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.letter-voice-play-btn:hover {
  background: #8B7355;
  color: #fff;
}

.letter-voice-progress-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.letter-voice-seek {
  width: 100%;
  -webkit-appearance: none;
  height: 2px;
  background: #DDD6C8;
  border: none;
  outline: none;
  cursor: pointer;
}

.letter-voice-seek::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #8B7355;
  cursor: pointer;
}

.letter-voice-time {
  font-family: 'Inter', sans-serif;
  font-size: 0.65rem;
  color: #B8A898;
  letter-spacing: 0.04em;
}

.form-actions {
  display: flex;
  gap: 12px;
}

.submit-btn {
  flex: 1;
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 400;
  padding: 12px;
  background: var(--text-primary);
  color: var(--bg);
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  letter-spacing: 0.05em;
}

.submit-btn:hover {
  opacity: 0.85;
}

.cancel-btn {
  flex: 1;
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 400;
  padding: 12px;
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.3s ease;
}

.cancel-btn:hover {
  border-color: var(--text-primary);
  color: var(--text-primary);
}

/* 写留言按钮 */
.write-msg-btn {
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 400;
  padding: 10px 28px;
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.3s ease;
  margin-bottom: 1.5rem;
  letter-spacing: 0.05em;
}

.write-msg-btn:hover {
  background: var(--text-primary);
  color: var(--bg);
  border-color: var(--text-primary);
}

/* ===== 个人详情页 ===== */
#personDetail {
  padding: 3rem 2rem 5rem 96px; /* left = sidebar(80px) + 16px gap */
  background: var(--bg-warm);
  align-items: center !important; /* center letter-paper horizontally */
}

/* 详情页留言列表 — 信纸风格 */
.person-messages {
  width: 100%;
  max-width: 800px;
  display: flex;
  flex-direction: column;
  gap: 4rem;
  padding-bottom: 6rem;
}

/* 信纸卡片 */
.letter-paper {
  position: relative;
  background: #FDF9F3;
  border-radius: 2px;
  padding: 56px 64px 56px 88px;
  min-height: 85vh;
  box-shadow:
    0 2px 8px rgba(0,0,0,0.06),
    0 6px 24px rgba(0,0,0,0.04),
    2px 2px 0 #F0EAE0;
  animation: letterUnfold 0.5s ease both;
  /* 横线：行高 40px，从顶部 56px 开始（对齐第一行文字） */
  background-image:
    /* 左侧红色边距线 */
    linear-gradient(to right, transparent 72px, #E8C4B8 72px, #E8C4B8 73.5px, transparent 73.5px),
    /* 横向格线 */
    repeating-linear-gradient(
      to bottom,
      transparent,
      transparent 39px,
      #DDD6C8 39px,
      #DDD6C8 40px
    );
  background-position: 0 0, 0 55px;
  background-size: 100% 100%, 100% 40px;
}

/* 信纸展开动画 */
@keyframes letterUnfold {
  from {
    opacity: 0;
    transform: translateY(16px) scaleY(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scaleY(1);
  }
}

/* 信纸顶部折角 */
.letter-paper::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 22px 22px 0;
  border-color: transparent #E8E0D4 transparent transparent;
  filter: drop-shadow(-1px 1px 1px rgba(0,0,0,0.08));
}

/* 信纸序号角标 */
.letter-paper .letter-index {
  position: absolute;
  top: 14px;
  left: 18px;
  font-family: 'Noto Serif SC', Georgia, serif;
  font-size: 0.65rem;
  color: #C4A882;
  letter-spacing: 0.08em;
  user-select: none;
}

/* 时间戳 */
.letter-paper .letter-time {
  position: absolute;
  bottom: 14px;
  right: 20px;
  font-size: 0.65rem;
  color: #B8A898;
  letter-spacing: 0.06em;
  font-style: italic;
}

/* 信纸正文 — 逐字显现，初始透明 */
.letter-paper .letter-content {
  font-family: 'Noto Serif SC', Georgia, 'Songti SC', serif;
  font-size: 1.05rem;
  font-weight: 400;
  color: #2C2420;
  line-height: 2.5rem; /* 与格线 40px 对齐 */
  white-space: pre-wrap;
  word-break: break-word;
  letter-spacing: 0.05em;
  opacity: 0;
  transition: opacity 0.2s ease;
}

/* Dear 称谓行 */
.letter-paper .letter-salutation {
  font-family: 'Cormorant Garamond', 'Noto Serif SC', serif;
  font-size: 1.05rem;
  font-weight: 500;
  font-style: italic;
  color: #5A4A3A;
  line-height: 2.5rem;
  letter-spacing: 0.08em;
  margin-bottom: 0;
}

/* 署名行 */
.letter-paper .letter-signature {
  font-family: 'Cormorant Garamond', 'Noto Serif SC', serif;
  font-size: 1rem;
  font-weight: 400;
  font-style: italic;
  color: #8B7355;
  line-height: 2.5rem;
  letter-spacing: 0.1em;
  margin-top: 0;
  text-align: right;
  padding-right: 2rem;
}

/* 植物/树枝装饰 SVG */
.letter-deco {
  position: absolute;
  pointer-events: none;
  user-select: none;
}

.letter-deco-branch {
  top: -8px;
  right: 10px;
  width: 160px;
  height: 100px;
  opacity: 0.75;
}

.letter-deco-plant {
  bottom: 20px;
  left: 12px;
  width: 80px;
  height: 120px;
  opacity: 0.6;
}

/* ===== 通用导航 ===== */
.section-nav {
  text-align: center;
  margin: 2.5rem 0;
}

.section-btn {
  font-family: 'Inter', sans-serif;
  font-size: 0.8rem;
  font-weight: 400;
  padding: 8px 24px;
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.3s ease;
  letter-spacing: 0.05em;
}

.section-btn:hover {
  color: var(--text-primary);
  border-color: var(--text-primary);
}

/* ===== 过渡动画 ===== */
.transition-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg);
  z-index: 999;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.transition-overlay.show {
  display: block;
  opacity: 0.6;
}

/* ===== 响应式 ===== */
@media (max-width: 480px) {
  .cover-title {
    font-size: 2rem;
  }

  .photo-container {
    min-height: 300px;
  }

  .nav-controls {
    gap: 1.5rem;
  }
}

/* ===== 上传进度条 ===== */
#uploadProgressBar {
  margin-top: 12px;
  display: none;
}

.upload-progress-inner {
  width: 100%;
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.upload-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.2s ease;
}

.upload-progress-text {
  display: block;
  margin-top: 6px;
  font-family: 'Inter', sans-serif;
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-align: center;
}

/* ===== Toast 提示 ===== */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--text-primary);
  color: var(--bg);
  padding: 12px 24px;
  font-size: 0.85rem;
  font-weight: 300;
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 1000;
  letter-spacing: 0.05em;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ===== 照片灯箱 (lightbox) ===== */
.photo-lightbox {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(0, 0, 0, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
  animation: fadeIn 0.2s ease;
  /* 防止滚轮事件穿透到页面 */
  overscroll-behavior: none;
}

.photo-lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 20px 80px rgba(0, 0, 0, 0.6);
  cursor: default;
  transform-origin: center center;
  transition: transform 0.05s ease;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

.photo-lightbox img.zoomed {
  cursor: grab;
}

.photo-lightbox img.dragging {
  cursor: grabbing;
  transition: none;
}

.photo-lightbox-hint {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'Inter', sans-serif;
  font-size: 0.68rem;
  font-weight: 300;
  letter-spacing: 0.12em;
  color: rgba(255, 255, 255, 0.35);
  pointer-events: none;
}

/* 详情页主图加放大鼠标提示 */
.detail-photo-zone > img#detailImg {
  cursor: zoom-in;
}

/* ===== 照片详情页左下角删除按钮 ===== */
.detail-delete-btn {
  position: absolute;
  left: 24px;
  bottom: 24px;
  z-index: 60;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s ease;
}

.detail-delete-btn:hover {
  color: #fff;
  background: #c0392b;
  border-color: #c0392b;
}

/* ===== 信纸留言删除按钮（悬停显现）===== */
.letter-delete {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 6;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.85);
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: all 0.25s ease;
}

.letter-paper:hover .letter-delete {
  opacity: 1;
}

.letter-delete:hover {
  color: #fff;
  background: #c0392b;
  border-color: #c0392b;
}

/* ===== 背景音乐开关（右上角固定）===== */
.music-control {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1001;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.music-buttons {
  display: flex;
  align-items: center;
  gap: 0;
}

.music-toggle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  flex-shrink: 0;
}

.music-next {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease, box-shadow 0.3s ease, opacity 0.25s ease;
  flex-shrink: 0;
  opacity: 0;
  margin-left: 6px;
}

.music-next svg {
  width: 16px;
  height: 16px;
}

.music-control:hover .music-next {
  opacity: 1;
}

.music-next:hover {
  transform: scale(1.06);
  box-shadow: 0 4px 16px var(--shadow-hover);
  color: var(--accent);
}

.music-volume-group {
  display: flex;
  align-items: center;
  gap: 0;
}

.music-volume-icon {
  width: 0;
  height: 16px;
  opacity: 0;
  overflow: hidden;
  transition: width 0.25s ease, opacity 0.25s ease, margin-right 0.25s ease;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.music-control:hover .music-volume-icon {
  width: 18px;
  opacity: 0.7;
  margin-right: 6px;
}

.music-volume {
  width: 0;
  opacity: 0;
  transition: width 0.25s ease, opacity 0.25s ease, margin 0.25s ease;
  margin-left: 0;
  height: 3px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--border);
  border-radius: 2px;
  outline: none;
}

.music-control:hover .music-volume {
  width: 70px;
  opacity: 1;
  margin-left: 0;
}

.music-volume::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}

.music-volume::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  cursor: pointer;
}

/* 音量图标波形随音量变化 */
.music-volume-icon .vol-wave-1,
.music-volume-icon .vol-wave-2 {
  opacity: 0;
  transition: opacity 0.2s ease;
}
.music-volume-icon .vol-wave-1 { opacity: 1; }
.music-volume-icon .vol-wave-2 { opacity: 1; }

.music-seek-group {
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
}

.music-control:hover .music-seek-group {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.music-time {
  font-size: 10px;
  font-family: 'Courier New', monospace;
  color: var(--text-muted);
  min-width: 28px;
  text-align: center;
  flex-shrink: 0;
}

.music-seek {
  width: 140px;
  height: 3px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--border);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.music-seek::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.5);
}

.music-seek::-moz-range-thumb {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  cursor: pointer;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.5);
}

.music-toggle:hover {
  transform: scale(1.06);
  box-shadow: 0 4px 16px var(--shadow-hover);
}

.music-off-icon {
  width: 18px;
  height: 18px;
  display: block;
}

.music-bars {
  display: none;
  align-items: flex-end;
  gap: 3px;
  height: 16px;
}

.music-toggle.playing .music-off-icon { display: none; }
.music-toggle.playing .music-bars { display: flex; }

.music-bars i {
  width: 3px;
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transform-origin: bottom;
  animation: musicBar 1.1s ease-in-out infinite;
}

.music-bars i:nth-child(1) { animation-delay: 0s; }
.music-bars i:nth-child(2) { animation-delay: 0.25s; }
.music-bars i:nth-child(3) { animation-delay: 0.5s; }

@keyframes musicBar {
  0%, 100% { transform: scaleY(0.35); }
  50% { transform: scaleY(1); }
}

/* ===== 口令门禁 ===== */
.passcode-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 960;
  background: rgba(250, 250, 248, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  align-items: center;
  justify-content: center;
}

.passcode-overlay.show {
  display: flex;
  animation: fadeIn 0.25s ease;
}

.passcode-card {
  width: min(360px, calc(100vw - 48px));
  background: var(--card-bg);
  border: 1px solid var(--border);
  padding: 40px 36px 32px;
  text-align: center;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.1);
  animation: fadeInUp 0.3s ease;
}

.passcode-badge {
  display: inline-block;
  font-family: 'Cormorant Garamond', serif;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid var(--border);
  padding: 5px 14px 4px;
  margin-bottom: 20px;
}

.passcode-title {
  font-family: 'Noto Serif SC', serif;
  font-size: 1rem;
  font-weight: 400;
  color: var(--text-primary);
  letter-spacing: 0.08em;
  margin-bottom: 24px;
}

.passcode-title #passcodeTargetName {
  color: var(--accent);
  font-weight: 500;
}

.passcode-input {
  width: 100%;
  border: none;
  border-bottom: 1px solid var(--border);
  background: transparent;
  padding: 10px 4px;
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  letter-spacing: 0.15em;
  text-align: center;
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.25s ease;
}

.passcode-input:focus {
  border-bottom-color: var(--accent);
}

.passcode-input.shake {
  animation: passcodeShake 0.4s ease;
  border-bottom-color: #C08A7A;
}

@keyframes passcodeShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-7px); }
  40% { transform: translateX(7px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(5px); }
}

.passcode-actions {
  display: flex;
  gap: 12px;
  margin-top: 28px;
}

.passcode-confirm,
.passcode-cancel {
  flex: 1;
  padding: 11px 0;
  font-family: 'Inter', 'Noto Serif SC', sans-serif;
  font-size: 0.82rem;
  letter-spacing: 0.12em;
  cursor: pointer;
  transition: all 0.25s ease;
}

.passcode-confirm {
  background: var(--text-primary);
  color: var(--bg);
  border: 1px solid var(--text-primary);
}

.passcode-confirm:hover {
  background: var(--accent);
  border-color: var(--accent);
}

.passcode-cancel {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.passcode-cancel:hover {
  border-color: var(--text-secondary);
  color: var(--text-primary);
}



/* 明确区分关闭、删除和快速阅读 */
.letter-actions { position:absolute; top:14px; right:14px; display:flex; gap:10px; z-index:8; }
.letter-actions .letter-delete, .letter-close { position:static; opacity:1; width:36px; height:36px; display:flex; align-items:center; justify-content:center; border:1px solid var(--border); border-radius:50%; background:#fff; color:var(--text-muted); cursor:pointer; }
.letter-close { font-size:25px; }
.letter-close:hover { background:#edf1e8; }
.reveal-all { position:relative; z-index:2; display:block; margin:12px 0; padding:8px 12px; border:1px solid #c8d4bd; border-radius:8px; background:#f2f5ee; color:#526646; cursor:pointer; font:inherit; font-size:13px; }
.reveal-all[hidden] { display:none; }
.reveal-all span { font-size:12px; }
.photo-overview-btn { position:absolute; right:24px; bottom:25px; z-index:40; padding:12px 18px; background:#fffaf1; border:1px solid #cfbfa5; border-radius:24px; color:#63513e; cursor:pointer; }
.photo-overview { position:fixed; inset:8vh 6vw 8vh max(80px, 6vw); z-index:1100; background:#fffaf4; border:1px solid #d5c6af; border-radius:18px; box-shadow:0 0 0 100vmax #29231eb3; display:flex; flex-direction:column; padding:20px; }
.overview-header { display:flex; justify-content:space-between; align-items:center; margin-bottom:16px; color:#63513e; }
.overview-header button { border:0; background:none; font-size:30px; cursor:pointer; padding:4px 12px; }
.overview-grid { overflow:auto; display:grid; grid-template-columns:repeat(auto-fill,minmax(110px,1fr)); gap:14px; }
.overview-photo { border:2px solid transparent; background:#eee4d5; border-radius:8px; overflow:hidden; padding:0; position:relative; cursor:pointer; aspect-ratio:1; }
.overview-photo img { width:100%; height:100%; object-fit:cover; display:block; }
.overview-photo span { position:absolute; bottom:4px; right:4px; background:#24201bc9; color:white; padding:2px 7px; border-radius:6px; }
.overview-photo.selected, .overview-photo:focus-visible { border-color:#74915d; }
.overview-link { border:0; background:none; color:#76644c; text-decoration:underline; cursor:pointer; font:inherit; }
.detail-progress-track { height:auto; min-height:28px; }
@media(max-width:600px) { .photo-overview { inset:5vh 12px 5vh 64px; padding:12px; } .overview-grid { grid-template-columns:repeat(auto-fill,minmax(80px,1fr)); gap:8px; } .photo-overview-btn { right:12px; bottom:90px; } .reveal-all span { display:block; } }

.overview-grid { min-height:0; grid-auto-rows:120px; align-content:start; }
.overview-photo { width:100%; height:120px; min-height:120px; aspect-ratio:auto; }
@media(max-width:600px) { .overview-grid { grid-auto-rows:90px; } .overview-photo { height:90px; min-height:90px; } }

.track-pause-btn { position:absolute; top:76px; right:24px; z-index:20; padding:10px 16px; border:1px solid #c8b5a0; border-radius:20px; background:#fff9ef; color:#574a40; cursor:pointer; }
.recovery-button { position:fixed; bottom:18px; right:18px; z-index:80; border:1px solid #c8b5a0; border-radius:20px; background:#fff9ef; padding:10px 16px; cursor:pointer; }
#recoveryDialog { max-width:540px; width:calc(100% - 40px); max-height:75vh; overflow:auto; border:1px solid #c8b5a0; border-radius:16px; padding:24px; background:#fff9ef; color:#574a40; }
#recoveryDialog::backdrop { background:#0008; }
#recoveryDialog button { padding:8px 16px; cursor:pointer; border:1px solid #c8b5a0; border-radius:10px; background:white; }
.recovery-row { display:flex; gap:16px; align-items:center; justify-content:space-between; border-top:1px solid #dbcbbb; padding:16px 0; }
.comment-delete { min-width:32px; min-height:32px; }

.recovery-button { right:auto; left:100px; }
@media (hover:none) { .comment-delete { opacity:1; } }

#deleteUndoStack { position:fixed; bottom:78px; left:50%; transform:translateX(-50%); z-index:150; display:flex; flex-direction:column; gap:8px; max-width:calc(100vw - 32px); }
.delete-undo { display:flex; align-items:center; gap:24px; padding:14px 20px; border-radius:14px; background:#40382f; color:#fff9ef; box-shadow:0 6px 24px #0003; opacity:1; transition:opacity 1.2s ease; }
.delete-undo.fading { opacity:0; }
.delete-undo button { border:1px solid #e3cda9; color:#ffe0a5; border-radius:8px; padding:8px 12px; background:transparent; cursor:pointer; white-space:nowrap; }
.recovery-row span { white-space:pre-line; overflow-wrap:anywhere; flex:1; }
.recovery-row button { flex-shrink:0; }
@media (prefers-reduced-motion:reduce) { .delete-undo { transition:none; } }
/* 白哈巴实拍首页：交互层不修改相册数据。 */
#cover { min-height:100svh;background:#07110f;isolation:isolate; }
.cover-photo { position:absolute;inset:0;width:100%;height:100%;object-fit:cover;object-position:center bottom;z-index:-2; }
#cover::after {content:"";position:absolute;inset:0;z-index:-1;background:linear-gradient(180deg,rgba(0,9,12,.08),transparent 55%,rgba(0,0,0,.45));pointer-events:none;}
#starfield {z-index:0;touch-action:pan-y;}
#cover .cover-content {position:absolute;bottom:17%;gap:20px;pointer-events:none;animation:fadeInUp 1.5s ease both;}
#cover .cover-subtitle {font-family:'Noto Serif SC',serif;font-size:clamp(14px,1.25vw,19px);text-transform:none;letter-spacing:.28em;color:rgba(255,255,255,.86);text-shadow:0 2px 15px #000;animation:none;}
#cover .enter-btn {pointer-events:auto;font-family:'Noto Serif SC',serif;font-style:normal;font-size:14px;letter-spacing:.2em;padding:12px 28px;background:rgba(5,20,22,.22);animation:none;}
.enter-btn span {margin-left:16px;}
.sky-hotspot,.sky-tree {position:absolute;z-index:2;color:#eef6ea;background:transparent;border:0;cursor:pointer;text-shadow:0 1px 10px #000;font-family:'Noto Serif SC',serif;}
.sky-hotspot {display:flex;flex-direction:column;align-items:center;gap:12px;padding:18px;}
.sky-hotspot>span {display:grid;place-items:center;width:38px;height:38px;border:1px solid #e1eee244;border-radius:50%;font-size:23px;transition:background .3s,box-shadow .3s;}
.sky-hotspot:hover>span,.sky-hotspot:focus-visible>span {background:#d6ead31a;box-shadow:0 0 28px #d6ead333;}
.sky-hotspot small {font-size:11px;letter-spacing:.15em;opacity:.75;}
.sky-letter {left:12%;top:23%;user-select:none;-webkit-user-select:none;touch-action:none;}
.sky-letter.holding>span {animation:collectLight .7s linear forwards;}
@keyframes collectLight {to{box-shadow:0 0 0 15px #e5eac633,0 0 45px #f8eabc99;background:#f4e8c34d;transform:rotate(90deg);}}
.sky-location {right:11%;top:44%;}
.sky-caption {position:absolute;right:9%;top:57%;z-index:2;color:#f2efdb;font-family:'Noto Serif SC',serif;font-size:13px;letter-spacing:.1em;opacity:0;transform:translateY(8px);transition:opacity .6s,transform .6s;pointer-events:none;text-shadow:0 2px 12px #000;}
.sky-caption.visible {opacity:1;transform:translateY(0);}
.sky-tree {bottom:7%;left:7%;padding:20px 12px;font-size:11px;letter-spacing:.14em;opacity:.7;}
.sky-tree:hover {opacity:1;}
.sky-guide {position:absolute;bottom:25px;left:20px;right:20px;text-align:center;z-index:1;pointer-events:none;color:#e5eadd99;font-size:10px;letter-spacing:.15em;}
body:has(#cover.active) .recovery-button {display:none;}
@media(max-width:600px){.sky-letter{left:3%;top:17%;}.sky-location{right:2%;top:39%;}.sky-caption{right:5%;top:54%;font-size:11px;}#cover .cover-content{bottom:22%;}.sky-tree{left:4%;bottom:10%;}.sky-guide{font-size:9px;letter-spacing:.05em;}.sky-hotspot small{font-size:10px;}}
@media(prefers-reduced-motion:reduce){.sky-letter.holding>span{animation:none;}#cover .cover-content{animation:none;}.sky-caption{transition:none;}}
#cover.constellating .sky-letter {opacity:0;pointer-events:none;transition:opacity .5s;}

.sky-hotspot{margin:0;padding:18px 8px;transition:opacity .25s;}
.sky-hotspot:hover small,.sky-hotspot:focus-visible small{opacity:1;}
.sky-hotspot:focus-visible{outline:1px dashed #e1eee277;outline-offset:3px;}
.sky-letter.holding small{animation:skyHold .7s ease forwards;}
@keyframes skyHold{to{opacity:1;text-shadow:0 0 14px #fff;}}
@media(prefers-reduced-motion:reduce){.sky-letter.holding small{animation:none;}}
