/* ========== 全局 ========== */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --lotso-pink: #d4567a;
  --lotso-light: #e899ae;
  --lotso-bg: #f9e8ef;
  --lotso-dark: #b33d5e;
  --lotso-fur: #d4688a;
  --lotso-nose: #8b3a5c;
  --pink-light: #f2c0d0;
  --shadow: 0 4px 20px rgba(180,61,94,0.15);
  --radius: 16px;
  --font: 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

body {
  font-family: var(--font);
  background: var(--lotso-bg);
  min-height: 100vh;
  overflow-x: hidden;
}

.hidden { display: none !important; }

/* ========== CSS 草莓熊 Lotso ========== */

/* 锁屏大版 Lotso */
.lotso-lock { margin-bottom: 10px; }

.lotso-face {
  position: relative;
  width: 120px; height: 120px;
  margin: 0 auto;
}

.lotso-face.small { width: 80px; height: 80px; }

.lotso-ears {
  position: absolute; top: -8px; width: 100%; display: flex;
  justify-content: space-between; padding: 0 8px; z-index: 0;
}

.lotso-face.small .lotso-ears { top: -6px; padding: 0 5px; }

.lotso-ear {
  width: 35px; height: 35px;
  background: var(--lotso-fur);
  border-radius: 50%;
  border: 3px solid #c05577;
}

.lotso-face.small .lotso-ear { width: 24px; height: 24px; border-width: 2px; }

.lotso-ear.left { transform: rotate(-15deg); }
.lotso-ear.right { transform: rotate(15deg); }

.lotso-head {
  position: relative; z-index: 1;
  width: 100%; height: 100%;
  background: linear-gradient(160deg, #e08aaa 0%, var(--lotso-fur) 40%, #c05577 100%);
  border-radius: 50% 50% 48% 48%;
  border: 3px solid #c05577;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}

.lotso-face.small .lotso-head { border-width: 2px; }

.lotso-eyes {
  display: flex; gap: 22px;
  margin-top: 5px;
}

.lotso-face.small .lotso-eyes { gap: 14px; margin-top: 2px; }

.lotso-eye {
  width: 22px; height: 22px;
  background: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid #8b3a5c;
}

.lotso-face.small .lotso-eye { width: 15px; height: 15px; border-width: 1.5px; }

.lotso-eye.happy { border-radius: 50% 50% 0 0; height: 12px; overflow: hidden; }
.lotso-face.small .lotso-eye.happy { height: 8px; }

.lotso-pupil {
  width: 10px; height: 10px;
  background: #2c1320;
  border-radius: 50%;
  position: relative;
}

.lotso-face.small .lotso-pupil { width: 7px; height: 7px; }

.lotso-pupil::after {
  content: '';
  position: absolute; top: 2px; left: 2px;
  width: 4px; height: 4px;
  background: #fff;
  border-radius: 50%;
}

.lotso-face.small .lotso-pupil::after { width: 3px; height: 3px; top: 1px; left: 1px; }

.lotso-nose {
  width: 18px; height: 12px;
  background: var(--lotso-nose);
  border-radius: 50%;
  margin-top: 4px;
}

.lotso-face.small .lotso-nose { width: 12px; height: 8px; margin-top: 2px; }

.lotso-mouth {
  width: 20px; height: 8px;
  border-bottom: 2.5px solid #8b3a5c;
  border-radius: 0 0 50% 50%;
  margin-top: 2px;
}

.lotso-mouth.smile {
  width: 24px; height: 10px;
  border-bottom: 3px solid #8b3a5c;
}

.lotso-face.small .lotso-mouth { width: 14px; height: 5px; border-bottom-width: 2px; }
.lotso-face.small .lotso-mouth.smile { width: 16px; height: 7px; }

/* 顶栏迷你 Lotso */
.lotso-mini {
  position: relative;
  width: 36px; height: 36px;
  flex-shrink: 0;
}

.lotso-mini-ear {
  position: absolute; top: -2px;
  width: 12px; height: 12px;
  background: var(--lotso-fur);
  border-radius: 50%;
  border: 1.5px solid #c05577;
}

.lotso-mini-ear.left { left: 2px; transform: rotate(-15deg); }
.lotso-mini-ear.right { right: 2px; transform: rotate(15deg); }

.lotso-mini-head {
  position: absolute; top: 3px; left: 1px;
  width: 34px; height: 33px;
  background: linear-gradient(160deg, #e08aaa, var(--lotso-fur));
  border-radius: 50%;
  border: 1.5px solid #c05577;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}

.lotso-mini-eyes {
  display: flex; gap: 7px;
}

.lotso-mini-eye {
  width: 6px; height: 6px;
  background: #2c1320;
  border-radius: 50%;
}

.lotso-mini-nose {
  width: 6px; height: 4px;
  background: var(--lotso-nose);
  border-radius: 50%;
  margin-top: 1px;
}

/* Lotso 弹跳动画 */
.lotso-lock {
  animation: lotsoBounce 3s ease-in-out infinite;
}

@keyframes lotsoBounce {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  25% { transform: translateY(-8px) rotate(-3deg); }
  75% { transform: translateY(-5px) rotate(3deg); }
}

/* ========== 锁屏 ========== */
.lock-screen {
  position: fixed; inset: 0;
  background: linear-gradient(135deg, #f9e8ef 0%, #f2c0d0 30%, #e899ae 60%, var(--lotso-light) 100%);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
}

.lock-card {
  background: rgba(255,255,255,0.88);
  backdrop-filter: blur(20px);
  border-radius: 30px;
  padding: 40px 40px 35px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(180,61,94,0.25);
  max-width: 380px; width: 90%;
  animation: fadeInUp 0.8s ease;
  border: 2px solid rgba(212,86,122,0.15);
}

.lock-card h1 {
  color: var(--lotso-dark);
  font-size: 1.5rem;
  margin: 10px 0 2px;
  letter-spacing: 2px;
}

.lock-subtitle {
  color: var(--lotso-light);
  font-size: 0.85rem;
  margin-bottom: 12px;
  font-style: italic;
}

.lock-hint {
  color: #9e4a6a;
  font-size: 0.9rem;
  margin-bottom: 16px;
}

.lock-status {
  color: var(--lotso-dark);
  font-size: 0.82rem;
  margin: -4px 0 14px;
  padding: 8px 12px;
  background: rgba(255,255,255,0.65);
  border: 1px solid rgba(212,86,122,0.18);
  border-radius: 12px;
  line-height: 1.45;
}

#password-input {
  width: 100%;
  padding: 14px 20px;
  border: 2px solid var(--pink-light);
  border-radius: 25px;
  font-size: 1.1rem;
  text-align: center;
  outline: none;
  background: rgba(255,255,255,0.7);
  transition: all 0.3s;
  letter-spacing: 4px;
}

#password-input:focus {
  border-color: var(--lotso-pink);
  box-shadow: 0 0 20px rgba(212,86,122,0.2);
  background: #fff;
}

.btn-pink {
  background: linear-gradient(135deg, var(--lotso-pink), var(--lotso-dark));
  color: #fff;
  border: none;
  padding: 12px 35px;
  border-radius: 25px;
  font-size: 1rem;
  cursor: pointer;
  margin-top: 15px;
  transition: all 0.3s;
  box-shadow: 0 4px 15px rgba(212,86,122,0.4);
  font-weight: 600;
}

.btn-pink:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(212,86,122,0.5);
}

.btn-pink:active { transform: translateY(0); }
.btn-small { padding: 8px 20px; font-size: 0.85rem; }

.lock-error {
  color: #b33d5e;
  font-size: 0.85rem;
  margin-top: 10px;
  min-height: 20px;
}

/* 锁屏模式选择 */
.lock-mode-selector {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}

.lock-mode-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 8px;
  border: 2px solid var(--pink-light);
  border-radius: 16px;
  background: rgba(255,255,255,0.7);
  cursor: pointer;
  transition: all 0.3s;
  font-family: var(--font);
}

.lock-mode-btn:hover {
  border-color: var(--lotso-light);
  transform: translateY(-2px);
}

.lock-mode-btn.active {
  border-color: var(--lotso-pink);
  background: linear-gradient(135deg, rgba(212,86,122,0.1), rgba(212,86,122,0.05));
  box-shadow: 0 3px 12px rgba(212,86,122,0.2);
}

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

.mode-label {
  font-size: 0.8rem;
  color: #9e4a6a;
  font-weight: 600;
  line-height: 1.2;
}

.lock-mode-btn.active .mode-label {
  color: var(--lotso-dark);
}

/* 确认密码输入框 */
#password-confirm {
  width: 100%;
  padding: 14px 20px;
  border: 2px solid var(--pink-light);
  border-radius: 25px;
  font-size: 1.1rem;
  text-align: center;
  outline: none;
  background: rgba(255,255,255,0.7);
  transition: all 0.3s;
  letter-spacing: 4px;
  margin-top: 10px;
}

#password-confirm:focus {
  border-color: var(--lotso-pink);
  box-shadow: 0 0 20px rgba(212,86,122,0.2);
  background: #fff;
}

/* 找回提示文案 */
.lock-login-tip {
  color: #9e4a6a;
  font-size: 0.78rem;
  margin-top: 12px;
  padding: 8px 14px;
  background: rgba(249,232,239,0.6);
  border-radius: 12px;
  line-height: 1.4;
}

/* 浮动装饰 */
.floating-strawberries {
  position: fixed; inset: 0;
  pointer-events: none; z-index: 0;
}

.float-item {
  position: absolute;
  font-size: 2rem;
  left: var(--x);
  animation: floatUp 8s ease-in-out infinite;
  animation-delay: var(--delay);
  opacity: 0.5;
}

@keyframes floatUp {
  0% { bottom: -50px; opacity: 0; transform: rotate(0deg); }
  50% { opacity: 0.5; }
  100% { bottom: 110vh; opacity: 0; transform: rotate(360deg); }
}

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

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-10px); }
  40% { transform: translateX(10px); }
  60% { transform: translateX(-10px); }
  80% { transform: translateX(10px); }
}

.shake { animation: shake 0.5s ease; }

/* ========== 主应用 ========== */
.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  animation: fadeInUp 0.6s ease;
}

/* 顶栏 */
.top-bar {
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(10px);
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 15px rgba(180,61,94,0.1);
  position: sticky; top: 0; z-index: 100;
  border-bottom: 2px solid var(--pink-light);
}

.top-left {
  display: flex; align-items: center; gap: 12px;
}

.top-bar h1 {
  color: var(--lotso-dark);
  font-size: 1.15rem;
  letter-spacing: 1px;
}

.btn-icon {
  background: none; border: none;
  font-size: 1.3rem; cursor: pointer;
  padding: 6px;
  border-radius: 12px;
  transition: all 0.3s;
}

.btn-icon:hover {
  background: var(--lotso-bg);
  transform: scale(1.1);
}

/* ========== 同步状态 ========== */
.sync-status {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: 16px;
  background: var(--lotso-bg);
  font-size: 0.8rem;
  color: #9e4a6a;
  transition: all 0.3s;
  cursor: default;
}

.sync-icon { font-size: 1rem; }
.sync-icon.syncing { animation: spin 1s linear infinite; }
.sync-text { font-weight: 500; white-space: nowrap; }

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

/* ========== 主布局 ========== */
.main-layout {
  display: flex;
  flex: 1;
}

/* 日历面板 */
.calendar-panel {
  width: 300px;
  background: rgba(255,255,255,0.95);
  padding: 20px;
  border-right: 2px solid var(--pink-light);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.calendar-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--lotso-dark);
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 0.8rem;
  color: #9e4a6a;
  font-weight: 600;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.calendar-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s;
  position: relative;
  color: #555;
  font-weight: 500;
}

.calendar-day:hover {
  background: #f9e8ef;
  transform: scale(1.1);
}

.calendar-day.today {
  background: var(--lotso-pink);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 3px 10px rgba(212,86,122,0.4);
}

.calendar-day.selected {
  outline: 3px solid var(--lotso-dark);
  outline-offset: -1px;
  font-weight: 700;
}

.calendar-day.today.selected {
  background: var(--lotso-dark);
}

.calendar-day.other-month {
  color: #ddd;
  cursor: default;
}

.calendar-day.other-month:hover {
  background: none;
  transform: none;
}

.calendar-day.future {
  color: #ccc;
  cursor: not-allowed;
}

.calendar-day.future:hover {
  background: none;
  transform: none;
}

.calendar-day.has-entry::after {
  content: '';
  position: absolute;
  bottom: 3px;
  width: 6px; height: 6px;
  background: var(--lotso-pink);
  border-radius: 50%;
}

.calendar-day.today.has-entry::after {
  background: #fff;
}

.calendar-legend {
  display: flex; align-items: center; gap: 6px;
  font-size: 0.8rem; color: #9e4a6a;
  padding: 4px 0;
  flex-wrap: wrap;
}

.legend-dot {
  width: 8px; height: 8px;
  border-radius: 50%; display: inline-block;
}

.legend-dot.has-entry { background: var(--lotso-pink); }
.legend-dot.is-today { background: var(--lotso-pink); margin-left: 10px; }

/* ========== 日记区 ========== */
.diary-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* 日期天气栏 */
.diary-info-bar {
  background: rgba(255,255,255,0.95);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid var(--pink-light);
}

.info-left { display: flex; align-items: baseline; gap: 10px; }

.diary-date {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--lotso-dark);
}

.diary-weekday {
  font-size: 0.9rem;
  color: #9e4a6a;
}

.weather-display {
  display: flex; align-items: center; gap: 8px;
  background: var(--lotso-bg);
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 0.9rem;
  color: #9e4a6a;
}

.weather-loading {
  color: #c09;
  font-size: 0.85rem;
}

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

.weather-temp {
  font-weight: 700;
  color: var(--lotso-dark);
}

.weather-desc {
  color: #9e4a6a;
}

/* ========== 心情选择 ========== */
.mood-section {
  background: rgba(255,255,255,0.95);
  padding: 14px 24px;
  border-bottom: 2px solid var(--pink-light);
  animation: fadeInUp 0.3s ease;
}

.mood-label {
  font-size: 0.9rem;
  color: #9e4a6a;
  margin-bottom: 10px;
  font-weight: 600;
}

.mood-choices {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.mood-choice {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 22px;
  border: 2px solid var(--pink-light);
  border-radius: 25px;
  background: #fff;
  cursor: pointer;
  transition: all 0.3s;
  font-size: 0.95rem;
}

.mood-choice:hover {
  border-color: var(--lotso-pink);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(212,86,122,0.15);
}

.mood-choice.selected {
  background: linear-gradient(135deg, var(--lotso-pink), var(--lotso-dark));
  color: #fff;
  border-color: var(--lotso-dark);
  box-shadow: 0 4px 15px rgba(212,86,122,0.35);
}

.mood-emoji { font-size: 1.4rem; }
.mood-text { font-weight: 600; }

.mood-choice.selected .mood-text { color: #fff; }

/* 心情只读模式 */
.mood-section.readonly .mood-choice {
  cursor: default;
  opacity: 0.7;
}

.mood-section.readonly .mood-choice:hover {
  transform: none;
  box-shadow: none;
}

.mood-section.readonly .mood-choice.selected {
  opacity: 1;
}

/* ========== 只读提示 ========== */
.readonly-notice {
  background: linear-gradient(135deg, #fff5f8, #ffeef3);
  padding: 20px 24px;
  display: flex; align-items: center; gap: 12px;
  border-bottom: 2px solid var(--pink-light);
  animation: fadeInUp 0.3s ease;
}

.readonly-icon { font-size: 1.5rem; }

.readonly-text {
  color: #9e4a6a;
  font-size: 0.95rem;
  font-weight: 500;
}

/* ========== 工具栏 ========== */
.diary-toolbar {
  background: rgba(255,255,255,0.95);
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  border-bottom: 2px solid var(--pink-light);
}

.toolbar-center { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.toolbar-right { display: flex; align-items: center; gap: 8px; }

.paper-selector, .color-selector {
  display: flex; align-items: center; gap: 6px;
}

.paper-selector label, .color-selector label {
  font-size: 0.8rem; color: #9e4a6a; font-weight: 600;
}

.paper-btn {
  width: 32px; height: 32px;
  border: 2px solid var(--pink-light);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.2s;
  display: flex; align-items: center; justify-content: center;
}

.paper-btn:hover { border-color: var(--lotso-pink); }
.paper-btn.active {
  border-color: var(--lotso-pink);
  background: var(--lotso-bg);
  box-shadow: 0 2px 8px rgba(212,86,122,0.2);
}

.color-btn {
  width: 24px; height: 24px;
  border: 2px solid var(--pink-light);
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s;
}

.color-btn:hover { transform: scale(1.2); }
.color-btn.active {
  border-color: var(--lotso-pink);
  box-shadow: 0 0 0 3px rgba(212,86,122,0.25);
  transform: scale(1.15);
}

/* ========== 贴纸面板 ========== */
.sticker-panel {
  background: rgba(255,255,255,0.95);
  padding: 10px 20px;
  border-bottom: 2px solid var(--pink-light);
  animation: fadeInUp 0.3s ease;
}

.sticker-tabs {
  display: flex; gap: 6px; margin-bottom: 10px;
}

.sticker-tab {
  padding: 4px 14px;
  border: 2px solid var(--pink-light);
  border-radius: 20px;
  background: #fff;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s;
  color: #9e4a6a;
}

.sticker-tab:hover { border-color: var(--lotso-light); }
.sticker-tab.active {
  background: var(--lotso-pink);
  color: #fff;
  border-color: var(--lotso-pink);
}

.sticker-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.sticker-item {
  font-size: 1.6rem;
  cursor: pointer;
  padding: 6px;
  border-radius: 10px;
  transition: all 0.2s;
  user-select: none;
}

.sticker-item:hover {
  background: #f9e8ef;
  transform: scale(1.3);
}

/* ========== Emoji面板 ========== */
.emoji-panel {
  background: rgba(255,255,255,0.95);
  padding: 10px 20px;
  border-bottom: 2px solid var(--pink-light);
  animation: fadeInUp 0.3s ease;
}

.emoji-tabs {
  display: flex; gap: 6px; margin-bottom: 10px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.emoji-tab {
  padding: 4px 14px;
  border: 2px solid var(--pink-light);
  border-radius: 20px;
  background: #fff;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s;
  color: #9e4a6a;
  white-space: nowrap;
  flex-shrink: 0;
}

.emoji-tab:hover { border-color: var(--lotso-light); }
.emoji-tab.active {
  background: var(--lotso-pink);
  color: #fff;
  border-color: var(--lotso-pink);
}

.emoji-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-height: 160px;
  overflow-y: auto;
}

.emoji-item {
  font-size: 1.5rem;
  cursor: pointer;
  padding: 5px;
  border-radius: 8px;
  transition: all 0.2s;
  user-select: none;
  line-height: 1;
}

.emoji-item:hover {
  background: #f9e8ef;
  transform: scale(1.3);
}

/* ========== 字数统计 ========== */
.word-count {
  position: absolute;
  bottom: 24px;
  left: 32px;
  font-size: 0.8rem;
  color: #c09;
  background: rgba(255,255,255,0.85);
  padding: 3px 10px;
  border-radius: 10px;
  pointer-events: none;
  opacity: 0.7;
  transition: opacity 0.3s;
  z-index: 5;
}

.diary-content:hover .word-count,
.diary-textarea:focus ~ .word-count {
  opacity: 1;
}

/* ========== 日记内容 ========== */
.diary-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 20px;
  position: relative;
}

.diary-stickers {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px 0;
  min-height: 10px;
}

.diary-sticker {
  font-size: 1.5rem;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 8px;
  transition: all 0.2s;
}

.diary-sticker:hover {
  background: rgba(212,86,122,0.1);
  transform: scale(1.2);
}

/* ========== 日记图片网格 ========== */
.diary-images {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 4px 0;
}

.diary-images:empty { display: none; }

.diary-image-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: 12px;
  overflow: hidden;
  background: var(--lotso-bg);
}

.diary-image-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: pointer;
  transition: transform 0.2s;
}

.diary-image-item img:hover {
  transform: scale(1.05);
}

.diary-image-item.uploading {
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-uploading-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--pink-light);
  border-top-color: var(--lotso-pink);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.image-delete-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 50%;
  background: rgba(0,0,0,0.5);
  color: #fff;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
  line-height: 1;
}

.diary-image-item:hover .image-delete-btn {
  opacity: 1;
}

/* ========== 图片预览弹窗 ========== */
.image-preview-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 600;
  animation: fadeIn 0.2s ease;
}

.image-preview-img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 8px;
}

.image-preview-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.image-preview-close:hover {
  background: rgba(255,255,255,0.4);
}

.diary-textarea {
  flex: 1;
  min-height: 400px;
  border: none;
  outline: none;
  font-size: 1.05rem;
  line-height: 2;
  padding: 20px;
  border-radius: var(--radius);
  resize: none;
  font-family: var(--font);
  transition: background 0.3s;
}

.diary-textarea:read-only {
  opacity: 0.85;
  cursor: default;
}

/* 纸张样式 */
.diary-textarea.paper-grid {
  background-size: 28px 28px;
  background-image:
    linear-gradient(to right, rgba(212,86,122,0.15) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(212,86,122,0.15) 1px, transparent 1px);
}

.diary-textarea.paper-lined {
  background-size: 100% 2em;
  background-image: linear-gradient(to bottom, transparent 95%, rgba(212,86,122,0.2) 95%);
  line-height: 2em;
}

.diary-textarea.paper-blank { background-image: none; }

.diary-textarea.paper-dot {
  background-size: 24px 24px;
  background-image: radial-gradient(circle, rgba(212,86,122,0.2) 1.2px, transparent 1.2px);
}

/* 纸张颜色 */
.paper-pink    { background-color: #fff0f5 !important; }
.paper-mint    { background-color: #f0fff4 !important; }
.paper-lavender{ background-color: #f5f0ff !important; }
.paper-lemon   { background-color: #fffff0 !important; }
.paper-peach   { background-color: #fff5ee !important; }
.paper-sky     { background-color: #f0f8ff !important; }
.paper-white   { background-color: #ffffff !important; }

/* ========== 保存成功弹窗 ========== */
.save-modal {
  position: fixed; inset: 0;
  background: rgba(180,61,94,0.3);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  z-index: 500;
  animation: fadeIn 0.3s ease;
}

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

.save-modal-card {
  background: #fff;
  border-radius: 30px;
  padding: 35px 40px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(180,61,94,0.3);
  max-width: 380px; width: 90%;
  animation: popIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes popIn {
  from { transform: scale(0.5); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.save-lotso { margin-bottom: 10px; }

.save-modal-card h2 {
  color: var(--lotso-dark);
  font-size: 1.2rem;
  margin-bottom: 12px;
}

.praise-word {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--lotso-pink);
  letter-spacing: 2px;
  margin-bottom: 6px;
  text-transform: uppercase;
  background: linear-gradient(135deg, var(--lotso-pink), #e06090, var(--lotso-dark));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.praise-meaning {
  font-size: 0.9rem;
  color: #9e4a6a;
  margin-bottom: 14px;
}

.save-confetti {
  font-size: 1.5rem;
  letter-spacing: 6px;
  margin-bottom: 14px;
  animation: confettiPulse 1s ease-in-out infinite alternate;
}

@keyframes confettiPulse {
  from { transform: scale(1); }
  to { transform: scale(1.08); }
}

/* ========== 日历折叠按钮（移动端可见） ========== */
.calendar-toggle-bar {
  display: none;
}

.calendar-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ========== 响应式 - 平板 ========== */
@media (max-width: 900px) {
  .calendar-panel { width: 260px; padding: 14px; }
  .calendar-day { font-size: 0.8rem; }
}

/* ========== 响应式 - 手机 ========== */
@media (max-width: 768px) {
  /* 布局改竖排 */
  .main-layout { flex-direction: column; }

  /* 顶栏 */
  .top-bar { padding: 8px 16px; }
  .top-bar h1 { font-size: 1rem; }
  .top-right { display: flex; align-items: center; gap: 6px; }
  .sync-status { padding: 3px 8px; font-size: 0.75rem; }
  .sync-icon { font-size: 0.85rem; }

  /* 日历折叠 */
  .calendar-panel {
    width: 100%;
    border-right: none;
    border-bottom: 2px solid var(--pink-light);
    padding: 0;
    gap: 0;
  }

  .calendar-toggle-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--lotso-dark);
    -webkit-tap-highlight-color: transparent;
  }

  .calendar-toggle-arrow {
    transition: transform 0.3s;
    font-size: 0.8rem;
  }

  .calendar-toggle-arrow.collapsed {
    transform: rotate(-90deg);
  }

  .calendar-body {
    overflow: hidden;
    transition: max-height 0.35s ease, padding 0.35s ease;
    max-height: 500px;
    padding: 0 16px 14px;
  }

  .calendar-body.collapsed {
    max-height: 0;
    padding: 0 16px;
  }

  .calendar-grid { gap: 2px; }
  .calendar-day { font-size: 0.85rem; border-radius: 10px; }

  /* 日期天气栏 */
  .diary-info-bar {
    padding: 10px 16px;
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
  }

  .diary-date { font-size: 1rem; }

  .weather-display {
    padding: 5px 12px;
    font-size: 0.82rem;
    gap: 6px;
    align-self: stretch;
    justify-content: center;
  }

  /* 心情选择 */
  .mood-section { padding: 12px 16px; }
  .mood-label { font-size: 0.85rem; margin-bottom: 8px; }
  .mood-choices { gap: 8px; }

  .mood-choice {
    padding: 8px 14px;
    font-size: 0.85rem;
    gap: 6px;
    flex: 1;
    justify-content: center;
    min-width: 0;
  }

  .mood-emoji { font-size: 1.2rem; }
  .mood-text { font-size: 0.8rem; }

  /* 只读提示 */
  .readonly-notice { padding: 14px 16px; }

  /* 工具栏 */
  .diary-toolbar {
    padding: 10px 16px;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .toolbar-center {
    gap: 10px;
    justify-content: space-between;
  }

  .paper-selector, .color-selector {
    gap: 4px;
  }

  .paper-selector label, .color-selector label {
    font-size: 0.75rem;
    white-space: nowrap;
  }

  .paper-btn { width: 28px; height: 28px; font-size: 0.9rem; }
  .color-btn { width: 22px; height: 22px; }

  .toolbar-right {
    justify-content: flex-end;
  }

  /* 贴纸面板 */
  .sticker-panel { padding: 10px 16px; }
  .sticker-tabs { gap: 4px; overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
  .sticker-tab { padding: 4px 10px; font-size: 0.8rem; white-space: nowrap; flex-shrink: 0; }
  .sticker-item { font-size: 1.4rem; padding: 5px; }

  /* Emoji面板 - 手机端 */
  .emoji-panel { padding: 10px 16px; }
  .emoji-tabs { gap: 4px; }
  .emoji-tab { padding: 4px 10px; font-size: 0.8rem; }
  .emoji-item { font-size: 1.3rem; padding: 4px; }
  .emoji-grid { max-height: 130px; }

  /* 字数统计 - 手机端 */
  .word-count { bottom: 16px; left: 20px; font-size: 0.75rem; opacity: 1; }

  /* 日记内容 */
  .diary-content { padding: 12px; }
  .diary-sticker { font-size: 1.3rem; }

  /* 日记图片 - 手机端 */
  .diary-images { gap: 6px; }
  .diary-image-item { border-radius: 8px; }
  .image-delete-btn { opacity: 1; } /* 手机端常显删除按钮 */

  .diary-textarea {
    min-height: 300px;
    padding: 14px;
    font-size: 0.95rem;
    border-radius: 12px;
  }

  /* 锁屏 */
  .lock-card {
    padding: 28px 24px 24px;
    border-radius: 24px;
    max-width: 340px;
  }

  .lock-card h1 { font-size: 1.3rem; }

  .lotso-face { width: 90px; height: 90px; }
  .lotso-ear { width: 28px; height: 28px; }
  .lotso-ears { top: -6px; padding: 0 6px; }
  .lotso-eyes { gap: 18px; }
  .lotso-eye { width: 18px; height: 18px; }
  .lotso-pupil { width: 8px; height: 8px; }
  .lotso-nose { width: 14px; height: 10px; }

  #password-input {
    padding: 12px 16px;
    font-size: 1rem;
  }

  #password-confirm {
    padding: 12px 16px;
    font-size: 1rem;
  }

  .lock-mode-selector {
    gap: 8px;
    margin-bottom: 10px;
  }

  .lock-mode-btn {
    padding: 10px 6px;
    border-radius: 12px;
  }

  .mode-icon { font-size: 1.2rem; }
  .mode-label { font-size: 0.72rem; }

  .lock-login-tip { font-size: 0.72rem; padding: 6px 10px; }

  .btn-pink { padding: 10px 28px; font-size: 0.95rem; }

  /* 保存弹窗 */
  .save-modal-card {
    padding: 28px 24px;
    border-radius: 24px;
    max-width: 320px;
  }

  .save-modal-card h2 { font-size: 1.1rem; }
  .praise-word { font-size: 1.8rem; }
  .praise-meaning { font-size: 0.85rem; }
  .save-confetti { font-size: 1.3rem; }
}

/* ========== 响应式 - 极小屏幕 ========== */
@media (max-width: 380px) {
  .lock-card { max-width: 95%; padding: 24px 18px; }
  .lock-card h1 { font-size: 1.1rem; letter-spacing: 1px; }
  .lotso-face { width: 70px; height: 70px; }
  .lotso-ear { width: 22px; height: 22px; }
  .lotso-eyes { gap: 14px; }
  .lotso-eye { width: 15px; height: 15px; }

  .mood-choices { flex-direction: column; }
  .mood-choice { flex: unset; }

  .toolbar-center { flex-direction: column; gap: 6px; }

  .praise-word { font-size: 1.5rem; }
  .diary-textarea { min-height: 250px; font-size: 0.9rem; }
}

/* ========== iOS 安全区域 ========== */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .diary-content {
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
  }
  .save-modal {
    padding-bottom: env(safe-area-inset-bottom);
  }
}
