/* 心记 · Claymorphism 风格 */
:root {
  --bg1: #fdf3f7;
  --bg2: #f1ecff;
  --card: #fffdfc;
  --text: #5b4a58;
  --muted: #a394a0;
  --accent: #e2728a;
  --accent-dark: #cd5d76;
  --lavender: #c4b5fd;
  --mint: #a7f3d0;
  --clay-shadow-dark: rgba(155, 105, 140, 0.16);
  --clay-shadow-light: rgba(255, 255, 255, 0.9);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --radius: 26px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: linear-gradient(135deg, var(--bg1) 0%, var(--bg2) 60%, #eef8f3 100%);
  color: var(--text);
  min-height: 100vh;
}
/* 背景装饰光斑 */
body::before, body::after {
  content: ''; position: fixed; border-radius: 50%; filter: blur(70px); z-index: -1; opacity: .5;
}
body::before { width: 420px; height: 420px; background: #f8b4d9; top: -140px; left: -140px; }
body::after { width: 380px; height: 380px; background: var(--mint); bottom: -150px; right: -120px; }

.hidden { display: none !important; }

/* ---------- 粘土基础 ---------- */
.clay {
  border-radius: var(--radius);
  box-shadow:
    10px 10px 24px var(--clay-shadow-dark),
    -6px -6px 16px var(--clay-shadow-light),
    inset 2px 2px 6px rgba(255, 255, 255, 0.85),
    inset -3px -3px 8px rgba(155, 105, 140, 0.10);
}

.animate-in { animation: claymorphism-fade-in 0.5s ease-out both; }
@keyframes claymorphism-fade-in {
  from { opacity: 0; transform: translateY(12px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.frost {
  backdrop-filter: blur(14px) saturate(170%);
  -webkit-backdrop-filter: blur(14px) saturate(170%);
  background: rgba(255, 255, 255, 0.72);
}

/* ---------- 按钮（Q弹物理） ---------- */
.btn {
  border: none; cursor: pointer; font-size: 14px;
  padding: 10px 18px; border-radius: 999px;
  background: transparent; color: var(--text);
  transition: all .25s var(--spring); font-family: inherit;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(135deg, #f8a5c0, var(--accent));
  color: #fff;
  box-shadow:
    6px 6px 14px rgba(226, 114, 138, 0.35),
    inset 2px 2px 4px rgba(255, 255, 255, 0.5),
    inset -3px -3px 6px rgba(0, 0, 0, 0.10);
}
.btn-primary:hover { transform: translateY(-3px); box-shadow: 10px 10px 20px rgba(226, 114, 138, 0.4), inset 2px 2px 4px rgba(255,255,255,.5), inset -3px -3px 6px rgba(0,0,0,.1); }
.btn-primary:active { transform: scale(.95) translateY(1px); box-shadow: inset 6px 6px 12px rgba(0, 0, 0, 0.18), inset -2px -2px 4px rgba(255, 255, 255, 0.4); }
.btn-ghost {
  background: #fff;
  color: var(--text);
  box-shadow:
    6px 6px 14px var(--clay-shadow-dark),
    inset 2px 2px 5px var(--clay-shadow-light),
    inset -3px -3px 6px rgba(155, 105, 140, 0.08);
}
.btn-ghost:hover { transform: translateY(-2px); color: var(--accent); }
.btn-ghost:active { transform: scale(.95); box-shadow: inset 5px 5px 10px rgba(155, 105, 140, 0.16), inset -2px -2px 5px var(--clay-shadow-light); }
.btn-danger {
  background: linear-gradient(135deg, #f8a5a5, #e26060);
  color: #fff;
  box-shadow:
    6px 6px 14px rgba(226, 96, 96, 0.3),
    inset 2px 2px 4px rgba(255, 255, 255, 0.45),
    inset -3px -3px 6px rgba(0, 0, 0, 0.12);
}
.btn-danger:hover { transform: translateY(-3px); }
.btn-danger:active { transform: scale(.95); }
.btn-block { width: 100%; }

/* ---------- 输入框（内凹效果） ---------- */
input, textarea {
  width: 100%; padding: 12px 14px; margin-bottom: 12px;
  border: none; border-radius: 16px;
  background: #fdf6fa; color: var(--text);
  font-size: 15px; outline: none; font-family: inherit;
  box-shadow:
    inset 5px 5px 10px rgba(155, 105, 140, 0.13),
    inset -4px -4px 10px var(--clay-shadow-light);
  transition: all .2s ease;
}
input:focus, textarea:focus {
  background: #fff;
  box-shadow:
    inset 3px 3px 8px rgba(155, 105, 140, 0.12),
    inset -3px -3px 8px #fff,
    0 0 0 2px rgba(226, 114, 138, 0.45);
}

/* ---------- 登录 / 注册 ---------- */
.login-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.login-card {
  background: var(--card); padding: 44px 36px; width: 100%; max-width: 400px; text-align: center;
}
.login-card .logo { font-size: 48px; }
.brand-title { font-size: 30px; letter-spacing: 10px; margin: 8px 0 4px;
  background: linear-gradient(135deg, #f8a5c0, #b49cf5);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.login-card .sub { color: var(--muted); font-size: 13px; margin-bottom: 22px; }

.auth-tabs {
  display: flex; background: #f6ebf2; border-radius: 999px; padding: 5px; margin-bottom: 16px;
  box-shadow: inset 3px 3px 8px rgba(155, 105, 140, 0.15), inset -3px -3px 8px var(--clay-shadow-light);
}
.auth-tab {
  flex: 1; border: none; background: transparent; border-radius: 999px; padding: 9px;
  cursor: pointer; color: var(--muted); font-size: 14px; font-family: inherit;
  transition: all .25s var(--spring);
}
.auth-tab.active {
  background: linear-gradient(135deg, #f8a5c0, var(--accent)); color: #fff;
  box-shadow: 3px 3px 8px rgba(226, 114, 138, 0.3);
}
.auth-tip { margin-top: 14px; color: var(--muted); font-size: 12px; }
.login-error { color: #d64545; font-size: 13px; min-height: 18px; margin-bottom: 8px; }

/* ---------- 顶栏 ---------- */
.topbar {
  box-shadow: 0 6px 24px rgba(155, 105, 140, 0.14);
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 22px; position: sticky; top: 0; z-index: 10;
}
.brand { font-size: 18px; font-weight: 600; }
.topbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- 布局 ---------- */
.layout {
  display: grid; grid-template-columns: 380px 1fr; gap: 22px;
  max-width: 1020px; margin: 26px auto; padding: 0 20px;
  align-items: start;
}
@media (max-width: 780px) { .layout { grid-template-columns: 1fr; } }

.panel {
  background: var(--card); border-radius: var(--radius); padding: 20px;
  box-shadow:
    10px 10px 24px var(--clay-shadow-dark),
    -6px -6px 16px var(--clay-shadow-light),
    inset 2px 2px 6px rgba(255, 255, 255, 0.85),
    inset -3px -3px 8px rgba(155, 105, 140, 0.10);
}

/* ---------- 日历 ---------- */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cal-title { font-size: 16px; font-weight: 600; }
.cal-weekdays { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.cal-day {
  aspect-ratio: 1; border: none; background: transparent; border-radius: 12px;
  font-size: 14px; cursor: pointer; position: relative; color: var(--text);
  display: flex; align-items: center; justify-content: center;
  transition: all .2s var(--spring); font-family: inherit;
}
.cal-day:hover { background: rgba(248, 180, 217, 0.4); transform: translateY(-2px); }
.cal-day.today { box-shadow: inset 0 0 0 2px var(--accent); }
.cal-day.selected {
  background: linear-gradient(135deg, #f8a5c0, var(--accent)); color: #fff;
  box-shadow: 4px 4px 10px rgba(226, 114, 138, 0.35), inset 2px 2px 4px rgba(255,255,255,.45), inset -3px -3px 6px rgba(0,0,0,.12);
  transform: scale(1.06);
}
.cal-day .dot {
  position: absolute; bottom: 14%; left: 50%; transform: translateX(-50%);
  width: 5px; height: 5px; border-radius: 50%; background: var(--accent);
}
.cal-day.selected .dot { background: #fff; }
.cal-blank { aspect-ratio: 1; }

/* ---------- 日记面板 ---------- */
.day-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 10px; flex-wrap: wrap; }
.day-head h2 { font-size: 18px; }
.empty { color: var(--muted); text-align: center; padding: 44px 0; font-size: 14px; }

.note-card {
  background: var(--card); border-radius: 22px; padding: 18px; margin-bottom: 16px;
  box-shadow:
    8px 8px 20px var(--clay-shadow-dark),
    -4px -4px 12px var(--clay-shadow-light),
    inset 2px 2px 5px rgba(255, 255, 255, 0.8),
    inset -2px -2px 6px rgba(155, 105, 140, 0.08);
  transition: transform .25s var(--spring);
}
.note-card:hover { transform: translateY(-3px); }
.note-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.note-card h3 { font-size: 16px; }
.author-badge { font-size: 11px; padding: 3px 12px; border-radius: 999px; white-space: nowrap; }
.badge-boy { background: #e3f3fd; color: #2c7fc4; box-shadow: inset 2px 2px 4px rgba(44,127,196,.15), inset -2px -2px 4px #fff; }
.badge-girl { background: #fdeaf3; color: #d05587; box-shadow: inset 2px 2px 4px rgba(208,85,135,.15), inset -2px -2px 4px #fff; }
.note-content { white-space: pre-wrap; line-height: 1.7; font-size: 15px; word-break: break-word; }
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.photo-grid img {
  width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 12px; cursor: zoom-in;
  box-shadow: 4px 4px 10px var(--clay-shadow-dark), inset 0 0 0 3px #fff;
}
.note-meta { color: var(--muted); font-size: 12px; margin-top: 12px; display: flex; justify-content: space-between; align-items: center; }
.note-actions { display: flex; gap: 4px; }
.mini-btn { border: none; background: transparent; cursor: pointer; color: var(--muted); font-size: 13px; padding: 4px 8px; border-radius: 8px; font-family: inherit; transition: all .15s; }
.mini-btn:hover { color: var(--accent); background: rgba(248, 180, 217, 0.3); }
.mini-btn.danger:hover { color: #d64545; }

/* ---------- 弹窗 ---------- */
.mask {
  position: fixed; inset: 0; background: rgba(90, 60, 90, 0.4);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px;
}
.editor {
  background: var(--card); border-radius: var(--radius); padding: 24px;
  width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto;
}
.editor h3 { margin-bottom: 14px; font-size: 17px; }
.field-label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 6px; }
.editor input[type="text"], .editor input[type="password"], .editor input[type="date"], .editor textarea { margin-bottom: 0; }
.editor textarea { resize: vertical; line-height: 1.7; }
.editor-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.editor-status { color: var(--muted); font-size: 13px; min-height: 18px; margin-top: 10px; }

.author-chips { display: flex; gap: 10px; }
.chip {
  border: none; cursor: pointer; padding: 8px 18px; border-radius: 999px;
  background: #fff; color: var(--muted); font-size: 13px; font-family: inherit;
  box-shadow: 4px 4px 10px var(--clay-shadow-dark), inset 2px 2px 5px var(--clay-shadow-light), inset -2px -2px 5px rgba(155, 105, 140, 0.07);
  transition: all .25s var(--spring);
}
.chip:hover { transform: translateY(-2px); }
.chip-boy.active { background: linear-gradient(135deg, #a8d8f8, #7cc7f5); color: #fff; box-shadow: 4px 4px 10px rgba(124, 199, 245, 0.4); }
.chip-girl.active { background: linear-gradient(135deg, #fbc2dd, #f8b4d9); color: #fff; box-shadow: 4px 4px 10px rgba(248, 180, 217, 0.5); }

#photos-box { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 10px; }
.photo-thumb { position: relative; width: 84px; height: 84px; }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; border-radius: 12px; box-shadow: inset 0 0 0 3px #fff, 3px 3px 8px var(--clay-shadow-dark); }
.thumb-del {
  position: absolute; top: -6px; right: -6px; width: 22px; height: 22px;
  border-radius: 50%; border: none; background: #e26060; color: #fff;
  font-size: 12px; cursor: pointer; line-height: 1;
  box-shadow: 2px 2px 6px rgba(0,0,0,.25);
}

/* ---------- 设置 ---------- */
.settings { max-width: 480px; }
.settings-avatar-row { display: flex; align-items: center; gap: 16px; margin-bottom: 14px; }
.avatar-lg {
  width: 84px; height: 84px; border-radius: 50%; object-fit: cover;
  border: 4px solid #fff;
  box-shadow: 6px 6px 14px var(--clay-shadow-dark), inset 2px 2px 6px var(--clay-shadow-light);
  background: #fdeaf3;
}
.settings-avatar-side { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.hint { color: var(--muted); font-size: 11px; }
.inline-row { display: flex; gap: 10px; align-items: flex-start; }
.inline-row input { flex: 1; margin-bottom: 0; }
.inline-row .btn { flex-shrink: 0; }
.divider { height: 1px; background: rgba(155, 105, 140, 0.15); margin: 18px 0; }
.danger-zone { display: flex; flex-direction: column; gap: 10px; align-items: stretch; }
.settings input { margin-bottom: 10px; }

/* ---------- 大图 ---------- */
.lightbox { position: fixed; inset: 0; background: rgba(50, 30, 45, 0.9); z-index: 200; display: flex; align-items: center; justify-content: center; cursor: zoom-out; }
.lightbox img { max-width: 94vw; max-height: 94vh; border-radius: 12px; }
.lightbox-close { position: absolute; top: 16px; right: 22px; color: #fff; font-size: 26px; cursor: pointer; }

/* ---------- 提示 ---------- */
.toast {
  position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%);
  background: rgba(90, 60, 90, 0.92); color: #fff; padding: 11px 22px;
  border-radius: 999px; font-size: 14px; z-index: 300;
  box-shadow: 6px 6px 16px rgba(0, 0, 0, 0.25), inset 1px 1px 3px rgba(255, 255, 255, 0.3);
}
