/* =========================================================
   Diary Feature Styles - 新版日记设计
   完全复刻 test-diary-design.html 的版型和配色
   ========================================================= */

/* ========== 日记生成中提示 ========== */
.diary-generating-tip {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: #999;
  font-size: 14px;
}
.diary-generating-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(212, 163, 115, 0.2);
  border-top-color: #d4a373;
  border-radius: 50%;
  animation: diary-spin 0.8s linear infinite;
  margin-bottom: 16px;
}
@keyframes diary-spin {
  to { transform: rotate(360deg); }
}

/* ========== 评语颜色选择器 ========== */
.diary-reply-color-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0;
  padding: 0 4px;
}
.diary-reply-color-row .color-label {
  font-size: 12px;
  color: #888;
  white-space: nowrap;
}
.diary-reply-color-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.2s, border-color 0.2s;
}
.diary-reply-color-dot:hover {
  transform: scale(1.15);
}
.diary-reply-color-dot.active {
  border-color: #fff;
  box-shadow: 0 0 0 2px rgba(0,0,0,0.3);
  transform: scale(1.15);
}

/* ========== 盖章选择行 ========== */
.diary-stamp-row {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin: 12px 0;
}
.diary-stamp-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}
.diary-stamp-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid #d4a373;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: bold;
  color: #d4a373;
  transition: transform 0.2s, background 0.2s;
}
.diary-stamp-item:active .diary-stamp-circle {
  transform: scale(0.9);
  background: rgba(212, 163, 115, 0.1);
}
.diary-stamp-label {
  font-size: 11px;
  color: #888;
}

/* ========== 日记上的大印章显示 ========== */
.diary-stamp-display {
position: absolute;
  width: 150px;
  height: 150px;
  z-index: 8;
  cursor: grab;
  user-select: none;
  animation: stamp-appear 0.3s ease;
}
.diary-stamp-display:active {
  cursor: grabbing;
}
.diary-stamp-display.dragging {
  opacity: 0.7;
  z-index: 20;
}
.diary-stamp-display .stamp-circle {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  border: 6px solid;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 42px;
  font-weight: bold;
  transform: rotate(-15deg);
  opacity: 0.8;
  text-shadow: 0 2px 4px rgba(0,0,0,0.15);
  font-family: 'GuoFengMaChaoGangBi', cursive;
}
.diary-stamp-display .stamp-label {
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%) rotate(15deg);
  font-size: 12px;
  color: inherit;
  opacity: 0.6;
  font-family: 'GuoFengMaChaoGangBi', cursive;
  white-space: nowrap;
}
.diary-stamp-display.stamp-heart .stamp-circle {
  border-color: #e74c3c;
  color: #e74c3c;
  font-size: 52px;
}
.diary-stamp-display.stamp-baka .stamp-circle {
  border-color: #d4a373;
  color: #d4a373;
  font-family: 'GuoFengMaChaoGangBi', cursive;
  font-size: 38px;
}
.diary-stamp-display.stamp-read .stamp-circle {
  border-color: #2d6b8a;
  color: #2d6b8a;
  font-family: 'GuoFengMaChaoGangBi', cursive;
  font-size: 38px;
}
.diary-stamp-display .stamp-delete {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 20px;
  height: 20px;
  background: rgba(0,0,0,0.5);
  color: #fff;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  cursor: pointer;
}
.diary-stamp-display:hover .stamp-delete {
  display: flex;
}
@keyframes stamp-appear {
  from { transform: scale(1.5) rotate(-30deg); opacity: 0; }
  to { transform: scale(1) rotate(0deg); opacity: 1; }
}


/* 引入隐秘心事字体 */
@font-face {
  font-family: 'GuoFengMaChaoGangBi';
  src: url('../字体/GuoFengMaChaoGangBiShouXieTi-2.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

/* 二级页面 diary-page 的 page-body */
#diary-page .page-body {
  background: #1a1a1a;
  padding: 15px;
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

/* 日记列表页 header */
#diary-page .page-header {
  background: #111 !important;
  border-bottom: 1px solid #333 !important;
}
#diary-page .page-header .page-title { color: #eee; }
#diary-page .page-header .page-back svg { stroke: #eee; }
#diary-page .page-header .page-action { color: #aaa !important; }

/* 日记列表卡片 */
.diary-list-item {
  background: #222;
  border: 1px solid #333;
  border-radius: 10px;
  padding: 14px 16px;
  cursor: pointer;
  transition: background 0.2s;
}
.diary-list-item:active { background: #2a2a2a; }
.diary-list-item .diary-item-date {
  font-size: 15px; font-weight: 600; color: #e0e0e0; margin-bottom: 4px;
}
.diary-list-item .diary-item-weather {
  font-size: 13px; color: #888; margin-bottom: 8px;
}
.diary-list-item .diary-item-preview {
  font-size: 13px; color: #666;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; line-height: 1.5;
}

/* 生成日记按钮 */
.diary-generate-btn {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  background: #2a2a2a; border: 1px dashed #555; border-radius: 10px;
  padding: 16px; color: #888; font-size: 14px; cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}
.diary-generate-btn:active { background: #333; border-color: #777; }

/* 日记列表空提示 */
.diary-empty-tip {
  text-align: center; color: #555; margin-top: 60px; font-size: 14px;
}

/* =========================================================
   日记详情页 - 完全复刻测试页面设计
   ========================================================= */
.diary-detail-page.show {
  background: #FFFFFF;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  display: flex;
  flex-direction: column;
}

/* --- 顶部工具栏 --- */
.diary-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px 10px;
  border-bottom: 1px solid #f0f0f0;
  background: #fff;
  position: sticky;
  top: 0;
  z-index: 20;
  flex-shrink: 0;
  position: relative;
}
.diary-toolbar-left {
  display: flex;
  gap: 20px;
  align-items: center;
}
.diary-toolbar-icon {
  cursor: pointer;
  opacity: 0.55;
  transition: opacity 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.diary-toolbar-icon:hover { opacity: 1; }
.diary-toolbar-icon:active { opacity: 1; }
.diary-toolbar-icon svg {
  width: 18px;
  height: 18px;
}
.diary-page-indicator {
  font-size: 13px;
  color: #999;
  font-weight: 300;
}

/* --- 可滚动内容区 --- */
.diary-scroll {
  flex: 1;
  overflow-y: auto;
  scroll-behavior: smooth;
  min-height: 0;
}
.diary-scroll::-webkit-scrollbar {
  width: 3px;
}
.diary-scroll::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 3px;
}

/* --- 引言横条 --- */
.diary-quote-banner {
  background: #f7f6f4;
  padding: 14px 24px;
  text-align: center;
  font-size: 12px;
  color: #999;
  letter-spacing: 1px;
  line-height: 1.8;
  border-bottom: 1px solid #eee;
  font-style: normal;
  margin: 0;
  border-radius: 0;
  border-left: none;
}

/* --- 角色信息卡 --- */
.diary-character-card {
  position: relative;
  margin: 0;
  padding: 24px 20px 20px;
  background: linear-gradient(135deg, #f5f3f0 0%, #eae7e3 100%);
  border-bottom: 1px solid #e0ddd9;
  overflow: hidden;
  border-radius: 0;
  border: none;
}
.diary-character-card::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: linear-gradient(to top, rgba(200,195,188,0.3), transparent);
  pointer-events: none;
}
.diary-card-content {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  position: relative;
  z-index: 2;
}
.diary-card-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 140px;
}
.diary-char-id {
  font-size: 15px;
  font-weight: 600;
  color: #333;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.diary-char-id::before {
  content: '◎';
  font-size: 12px;
  color: #aaa;
}
.diary-char-mood {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: #8a8a8a;
  background: rgba(255,255,255,0.6);
  padding: 3px 10px;
  border-radius: 12px;
  margin-bottom: 14px;
  width: fit-content;
}
.diary-mood-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #a3b8c8;
  flex-shrink: 0;
}
.diary-char-whisper {
  font-size: 12px;
  color: #777;
  line-height: 1.7;
  font-style: italic;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px dashed #ddd;
}
.diary-card-avatar {
  width: 200px;
  height: 150px;
  border-radius: 4px;
  overflow: hidden;
  border: 2px solid rgba(255,255,255,0.8);
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
  flex-shrink: 0;
}
.diary-card-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* --- 翻页箭头区 --- */
.diary-page-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid #f0f0f0;
}
.diary-nav-arrow {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid #ddd;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #999;
  font-size: 14px;
  background: #fff;
  transition: all 0.2s;
}
.diary-nav-arrow:hover {
  border-color: #aaa;
  color: #555;
}
.diary-nav-arrow:active {
  background: #f5f5f5;
  transform: scale(0.95);
}

/* --- 日期行 --- */
.diary-date-row {
  padding: 16px 24px 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.diary-date-label {
  font-size: 11px;
  color: #bbb;
  text-transform: uppercase;
  letter-spacing: 2px;
}
.diary-date-value {
  font-size: 13px;
  color: #666;
  font-weight: 300;
}
.diary-date-icons {
  margin-left: auto;
  display: flex;
  gap: 12px;
}
.diary-date-icon {
  display: flex;
  align-items: center;
  cursor: pointer;
  opacity: 0.4;
  transition: opacity 0.2s;
}
.diary-date-icon:hover { opacity: 0.8; }
.diary-date-icon:active { opacity: 0.8; }
.diary-date-icon svg {
  width: 15px;
  height: 15px;
}

/* --- 心情标题 --- */
.diary-mood-title {
  padding: 8px 24px 14px;
  font-size: 17px;
  font-weight: 600;
  color: #2d2d2d;
  line-height: 1.6;
  margin: 0;
  letter-spacing: 0;
}

/* --- 地点天气元数据 --- */
.diary-location-meta {
  padding: 0 24px 16px;
  font-size: 11px;
  color: #999;
  line-height: 1.8;
  display: block;
  margin: 0;
}

/* --- 分割线 --- */
.diary-divider {
  margin: 0 24px;
  height: 1px;
  background: linear-gradient(to right, transparent, #ddd, transparent);
}

/* --- 日记正文区 --- */
.diary-body-content {
  padding: 20px 24px 30px;
  margin: 0;
}
.diary-section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.diary-title-bar {
  width: 3px;
  height: 22px;
  background: #333;
  border-radius: 2px;
}
.diary-title-text {
  font-size: 18px;
  font-weight: 700;
  color: #1a1a1a;
  letter-spacing: 2px;
}
.diary-paragraphs {
  font-size: 14px;
  color: #444;
  line-height: 2.2;
}
.diary-paragraphs p,
.diary-paragraphs .diary-paragraph {
  font-size: 14px;
  line-height: 2.2;
  color: #444;
  text-align: justify;
  margin-bottom: 20px;
  text-indent: 2em;
}

/* --- 水墨装饰 --- */
.diary-ink-decoration {
  height: 30px;
  background: linear-gradient(to top, rgba(200,195,188,0.1), transparent);
  margin: 0;
  position: relative;
}
.diary-ink-decoration::after {
  display: none;
}

/* --- 底部印章 --- */
.diary-seal-area {
  display: flex;
  justify-content: center;
  padding: 10px 0 30px;
}
.diary-seal-btn {
  width: 60px;
  height: 60px;
  cursor: pointer;
  transition: transform 0.2s;
  opacity: 0.8;
  display: flex;
  align-items: center;
  justify-content: center;
}
.diary-seal-btn:hover {
  transform: scale(1.1);
  opacity: 1;
}
.diary-seal-btn:active {
  transform: scale(0.95);
}
.diary-seal-btn img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* --- 回复弹窗 --- */
.diary-reply-overlay {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.25);
  z-index: 50;
  align-items: center;
  justify-content: center;
}
.diary-reply-overlay.active {
  display: flex;
}
.diary-reply-panel {
  width: 85%;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 15px 50px rgba(0,0,0,0.15);
  animation: diaryFadeUp 0.3s ease;
}
@keyframes diaryFadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.diary-reply-panel textarea {
  width: 100%;
  height: 70px;
  border: 1px solid #e8e8e8;
  border-radius: 10px;
  padding: 12px;
  font-size: 13px;
  color: #555;
  resize: none;
  outline: none;
  font-family: inherit;
  margin-bottom: 14px;
  background: #fafafa;
  box-sizing: border-box;
}
.diary-stamp-row {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 14px;
}
.diary-stamp-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  gap: 4px;
}
.diary-stamp-circle {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s;
  font-size: 10px;
  font-weight: bold;
}
.diary-stamp-item:hover .diary-stamp-circle { transform: scale(1.1); }
.diary-stamp-item:active .diary-stamp-circle { transform: scale(0.95); }
.diary-stamp-heart .diary-stamp-circle {
  border: 2px solid #f0c4c4;
  background: #fff5f5;
  font-size: 18px;
}
.diary-stamp-baka .diary-stamp-circle {
  border: 2px solid #e88;
  background: #fff0f0;
  color: #c44;
}
.diary-stamp-read .diary-stamp-circle {
  border: 2px solid #c9a84c;
  background: #fffdf5;
  color: #8b7332;
}
.diary-stamp-label {
  font-size: 9px;
  color: #999;
}
.diary-reply-actions {
  display: flex;
  justify-content: space-around;
  padding-top: 10px;
  border-top: 1px solid #f0f0f0;
}
.diary-reply-actions button,
.diary-btn-cancel,
.diary-btn-post {
  background: none;
  border: none;
  font-size: 13px;
  cursor: pointer;
  padding: 6px 20px;
  font-family: inherit;
  border-radius: 6px;
  transition: background 0.2s;
}
.diary-clear-bg-btn {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  color: #999;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(0,0,0,0.05);
}
.diary-clear-bg-btn:active {
  background: rgba(0,0,0,0.1);
}

.diary-btn-cancel { color: #999; }
.diary-btn-cancel:hover { background: #f5f5f5; }
.diary-btn-post { color: #333; font-weight: 600; }
.diary-btn-post:hover { background: #f0f0f0; }

/* =========================================================
   日记联系人列表 - 二级页面样式
   ========================================================= */
.diary-contact-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #222;
  border: 1px solid #333;
  border-radius: 12px;
  padding: 14px 16px;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}
.diary-contact-item:active {
  background: #2a2a2a;
  transform: scale(0.98);
}
.diary-contact-avatar {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  overflow: hidden;
  flex-shrink: 0;
  border: 2px solid #444;
}
.diary-contact-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.diary-contact-info {
  flex: 1;
  min-width: 0;
}
.diary-contact-name {
  font-size: 15px;
  font-weight: 600;
  color: #e0e0e0;
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.diary-contact-id {
  font-size: 12px;
  color: #777;
  margin-bottom: 2px;
}
.diary-contact-meta {
  font-size: 12px;
  color: #999;
}
.diary-contact-arrow {
  font-size: 22px;
  color: #555;
  flex-shrink: 0;
}

/* =========================================================
   批注功能样式
   ========================================================= */
.diary-annotation {
  font-family: 'GuoFengMaChaoGangBi', cursive, sans-serif;
  font-style: italic;
  color: #8B4513;
  font-size: 14px;
  position: absolute;
  cursor: move;
  user-select: none;
  padding: 6px 12px;
  background: rgba(255, 248, 240, 0.9);
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  z-index: 10;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  max-width: 80%;
  transition: box-shadow 0.2s;
}

.diary-annotation:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.diary-annotation.dragging {
  opacity: 0.8;
  box-shadow: 0 6px 20px rgba(0,0,0,0.2);
  cursor: grabbing;
}

/* 批注删除按钮 */
.diary-annotation-delete {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ff4444;
  color: white;
  font-size: 12px;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-style: normal;
  line-height: 1;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.diary-annotation:hover .diary-annotation-delete {
  display: flex;
}

.diary-annotation-delete:active {
  transform: scale(0.9);
}

/* 批注操作面板（选择盖章或批注） */
.diary-action-panel {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.3);
  z-index: 50;
  align-items: center;
  justify-content: center;
}

.diary-action-panel.active {
  display: flex;
}

.diary-action-options {
  background: rgba(255,255,255,0.98);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 15px 50px rgba(0,0,0,0.2);
  animation: diaryFadeUp 0.3s ease;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 200px;
}

.diary-action-option {
  padding: 14px 20px;
  border-radius: 10px;
  background: #f8f8f8;
  border: 2px solid transparent;
  cursor: pointer;
  text-align: center;
  font-size: 15px;
  font-weight: 500;
  color: #333;
  transition: all 0.2s;
}

.diary-action-option:hover {
  background: #fff;
  border-color: #8B4513;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

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

.diary-action-cancel {
  padding: 10px;
  text-align: center;
  color: #999;
  font-size: 13px;
  cursor: pointer;
  margin-top: 8px;
}

.diary-action-cancel:hover {
  color: #666;
}

/* =========================================================
   日记生成中加载动画
   ========================================================= */
.diary-generating-tip {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  gap: 16px;
}
.diary-generating-tip p {
  font-size: 14px;
  color: #999;
  margin: 0;
  text-indent: 0 !important;
  text-align: center !important;
}
.diary-generating-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid #eee;
  border-top-color: #d4a373;
  border-radius: 50%;
  animation: diarySpinAnim 0.8s linear infinite;
}
@keyframes diarySpinAnim {
  to { transform: rotate(360deg); }
}

/* =========================================================
   批注样式统一（修复 class 不匹配问题）
   ========================================================= */
/* 批注容器覆盖整个日记正文区域，支持全局自由拖拽 */
#diaryAnnotationsContainer {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 10;
  min-height: 100%;
}
#diaryAnnotationsContainer .diary-annotation-item {
  pointer-events: auto;
}

.diary-annotation-item {
  touch-action: none; /* 移动端拖拽修复 */
  font-family: 'GuoFengMaChaoGangBi', cursive, sans-serif;
  font-style: italic;
  color: #8B4513;
  font-size: 14px;
  position: absolute;
  cursor: move;
  user-select: none;
  padding: 6px 12px;
  background: rgba(255, 248, 240, 0.9);
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  z-index: 10;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  max-width: 80%;
  transition: box-shadow 0.2s;
}
.diary-annotation-item:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.diary-annotation-item.dragging {
  opacity: 0.8;
  box-shadow: 0 6px 20px rgba(0,0,0,0.2);
  cursor: grabbing;
}
.diary-annotation-item .annotation-delete {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ff4444;
  color: white;
  font-size: 12px;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-style: normal;
  line-height: 1;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
.diary-annotation-item:hover .annotation-delete {
  display: flex;
}

/* =========================================================
   大印章样式（盖在日记上的超大印章）
   ========================================================= */
.diary-stamp-display {
  position: absolute;
  width: 150px;
  height: 150px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  cursor: move;
  user-select: none;
  z-index: 8;
  opacity: 0.8;
  transform: rotate(-12deg);
  transition: opacity 0.2s;
  animation: stamp-slam 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes stamp-slam {
  0% { transform: scale(2.5) rotate(-25deg); opacity: 0; }
  60% { transform: scale(0.9) rotate(-8deg); opacity: 0.9; }
  100% { transform: scale(1) rotate(-12deg); opacity: 0.8; }
}
.diary-stamp-display:hover {
  opacity: 1;
}
.diary-stamp-display.dragging {
  opacity: 0.9;
  transform: rotate(-12deg) scale(1.05);
}
.diary-stamp-display .stamp-circle {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  border: 6px solid currentColor;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  font-weight: bold;
  font-family: 'GuoFengMaChaoGangBi', serif;
  text-align: center;
  line-height: 1.2;
  padding: 10px;
  box-sizing: border-box;
}
.diary-stamp-display .stamp-label {
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%) rotate(12deg);
  font-size: 11px;
  color: inherit;
  opacity: 0.5;
  font-family: 'GuoFengMaChaoGangBi', serif;
  white-space: nowrap;
}
.diary-stamp-display .stamp-delete {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #ff4444;
  color: white;
  font-size: 14px;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-style: normal;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  transform: rotate(12deg);
}
.diary-stamp-display:hover .stamp-delete {
  display: flex;
}

/* 印章颜色预设 */
.diary-stamp-display.stamp-heart {
  color: #e74c3c;
}
.diary-stamp-display.stamp-heart .stamp-circle {
  font-size: 52px;
  border-width: 6px;
}
.diary-stamp-display.stamp-baka {
  color: #d4a373;
}
.diary-stamp-display.stamp-baka .stamp-circle {
  font-size: 36px;
}
.diary-stamp-display.stamp-read {
  color: #2d6b8a;
}
.diary-stamp-display.stamp-read .stamp-circle {
  font-size: 36px;
}

/* =========================================================
   颜色选择器行
   ========================================================= */
.diary-color-row {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 14px;
  align-items: center;
}
.diary-color-row .color-label {
  font-size: 11px;
  color: #999;
}
.diary-color-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.2s, border-color 0.2s;
}
.diary-color-dot:hover {
  transform: scale(1.2);
}
.diary-color-dot.active {
  border-color: #333;
  transform: scale(1.15);
}

/* =========================================================
   日记生成中 Loading 状态
   ========================================================= */
.diary-generating-overlay {
  position: absolute;
  inset: 0;
  background: rgba(245, 240, 235, 0.92);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 100;
  gap: 16px;
}
.diary-generating-overlay .diary-gen-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(180, 160, 140, 0.3);
  border-top-color: #8b7355;
  border-radius: 50%;
  animation: diary-spin 0.8s linear infinite;
}
.diary-generating-overlay .diary-gen-text {
  font-family: 'GuoFengMaChaoGangBi', serif;
  font-size: 18px;
  color: #6b5a47;
  letter-spacing: 2px;
}
@keyframes diary-spin {
  to { transform: rotate(360deg); }
}

/* =========================================================
   日记大印章覆盖样式
   ========================================================= */
.diary-stamp-overlay {
  position: absolute;
  pointer-events: none;
  z-index: 50;
  opacity: 0.75;
  animation: diary-stamp-appear 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.diary-stamp-overlay img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
@keyframes diary-stamp-appear {
  0% {
    transform: scale(2.5) rotate(-15deg);
    opacity: 0;
  }
  60% {
    transform: scale(0.9) rotate(2deg);
    opacity: 0.9;
  }
  100% {
    transform: scale(1) rotate(0deg);
    opacity: 0.75;
  }
}

/* 用户评语区域样式 */
.diary-user-annotation {
  margin-top: 20px;
  padding: 16px;
  border-top: 1px dashed rgba(139, 115, 85, 0.3);
}
.diary-user-annotation .annotation-label {
  font-size: 11px;
  color: #999;
  margin-bottom: 8px;
  letter-spacing: 1px;
}
.diary-user-annotation .annotation-text {
  font-family: 'GuoFengMaChaoGangBi', serif;
  font-size: 16px;
  line-height: 1.8;
  color: #5a4a3a;
}

/* 评语字体颜色选择器 */
.diary-reply-color-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(0,0,0,0.05);
}
.diary-reply-color-row .color-label {
  font-size: 12px;
  color: #888;
  white-space: nowrap;
}
.diary-reply-color-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.2s, border-color 0.2s;
}
.diary-reply-color-dot:hover {
  transform: scale(1.2);
}
.diary-reply-color-dot.active {
  border-color: #333;
  transform: scale(1.15);
}


/* ========== 日记设置面板 ========== */
.diary-settings-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4);
  z-index: 100;
  display: none;
  align-items: flex-end;
  justify-content: center;
}
.diary-settings-overlay.active {
  display: flex;
}
.diary-settings-panel {
  background: #fff;
  width: 100%;
  max-height: 75%;
  border-radius: 20px 20px 0 0;
  overflow-y: auto;
  animation: slideUp 0.3s ease;
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.diary-settings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  font-size: 16px;
  font-weight: 600;
  border-bottom: 1px solid #f0f0f0;
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
}
.diary-settings-body {
  padding: 16px 20px 30px;
}
.diary-settings-section {
  margin-bottom: 24px;
}
.diary-settings-title {
  font-size: 14px;
  font-weight: 600;
  color: #333;
  margin-bottom: 6px;
}
.diary-settings-desc {
  font-size: 12px;
  color: #999;
  margin-bottom: 12px;
  line-height: 1.5;
}
.diary-bg-upload-area {
  width: 100%;
  height: 120px;
  border: 2px dashed #ddd;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
  position: relative;
  transition: border-color 0.2s;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

/* 视觉隐藏但仍可被 JS 通过 .click() 触发文件选择器。
   不能用 display:none / visibility:hidden / opacity:0+pointer-events:none，
   某些 WebView (微信内置/QQ X5) 在这种状态下 .click() 会被忽略。
   下面是 W3C 推荐的"visually hidden"裁剪写法，对所有浏览器最安全。 */
.diary-hidden-file-input {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.diary-bg-upload-area:active {
  border-color: var(--main-pink);
}

.diary-settings-remove-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  background: rgba(0,0,0,0.5);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  cursor: pointer;
}
.diary-settings-add-btn {
  width: 100%;
  padding: 12px;
  text-align: center;
  border: 2px dashed #ddd;
  border-radius: 12px;
  color: var(--main-pink);
  font-size: 14px;
  cursor: pointer;
  margin-top: 12px;
  transition: background 0.2s;
  position: relative;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  box-sizing: border-box;
}
.diary-settings-add-btn:active {
  background: var(--light-pink);
}

/* 自定义印章列表 */
.custom-stamp-item {
  display: flex;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #f5f5f5;
  position: relative;
}
.custom-stamp-preview {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  margin-right: 12px;
  border: 1px solid #eee;
  flex-shrink: 0;
}
.custom-stamp-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.custom-stamp-name {
  flex: 1;
  font-size: 14px;
  color: #333;
}
.custom-stamp-delete {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ff4d4f;
  font-size: 16px;
  cursor: pointer;
  border-radius: 50%;
}
.custom-stamp-delete:active {
  background: rgba(255,77,79,0.1);
}

/* 盖章面板自定义章行 */
.diary-custom-stamps-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
}
.diary-stamp-custom .diary-stamp-circle {
  border: 2px solid #e8d5c8;
}
