/* ============================================================
   记录生活 · 温暖日记风
   ============================================================ */
:root {
  --bg-1: #faf6f0;
  --bg-2: #f3ebe0;
  --card: #fffdf9;
  --text: #3a3230;
  --muted: #9c8f85;
  --accent: #c58b6a;      /* 陶土色 */
  --accent-dark: #b0764f;
  --accent-2: #8a9b7e;    /* 鼠尾草绿 */
  --danger: #c0563a;
  --border: #e8ddcf;
  --shadow: 0 6px 24px rgba(120, 90, 60, .08);
  --shadow-hover: 0 12px 32px rgba(120, 90, 60, .15);
  --maxw: 720px;
  --radius: 14px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, var(--bg-1), var(--bg-2));
  background-attachment: fixed;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  line-height: 1.85;
  -webkit-font-smoothing: antialiased;
}
body.locked { overflow: hidden; }

.page {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 28px 22px 60px;
  animation: fadeUp .5s ease both;
}

/* ---- 头部 ---- */
.head { text-align: center; margin: 30px 0 34px; }
.head .mark { font-size: 46px; }
.head h1 {
  font-family: Georgia, "Songti SC", "STSong", serif;
  font-size: 34px; font-weight: 600; letter-spacing: 5px; margin: 10px 0 0;
}
.head .tag { color: var(--muted); font-size: 15px; letter-spacing: 1px; margin: 12px 0 0; }

/* ---- 密码门 ---- */
.gate {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(180deg, var(--bg-1), var(--bg-2));
  padding: 20px;
}
.gate__box {
  width: 100%; max-width: 340px;
  padding: 44px 30px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(120, 90, 60, .12);
  text-align: center;
  animation: fadeUp .5s ease both;
}
.gate__box .mark { font-size: 44px; margin-bottom: 12px; }
.gate__box h1 { font-family: Georgia, "Songti SC", serif; font-size: 26px; letter-spacing: 3px; margin: 0; }
.gate__sub { color: var(--muted); font-size: 14px; margin: 8px 0 24px; }
.gate__box input {
  width: 100%; padding: 13px 15px; font-size: 15px;
  border: 1px solid var(--border); border-radius: 10px;
  background: #fff; color: var(--text); outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.gate__box input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(197, 139, 106, .15); }
.gate__box button {
  width: 100%; margin-top: 14px; padding: 13px;
  font-size: 15px; font-weight: 600;
  border: none; border-radius: 10px;
  background: var(--accent); color: #fff; cursor: pointer;
  transition: filter .2s, transform .1s;
}
.gate__box button:hover { filter: brightness(.95); }
.gate__box button:active { transform: scale(.99); }
.gate__err { color: var(--danger); font-size: 14px; margin: 0 0 12px; }

/* ---- 新增表单 ---- */
.entry-form {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 28px;
  animation: fadeDown .3s ease both;
}
.form-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.form-head h3 { margin: 0; font-size: 17px; }
.icon-btn { background: none; border: none; color: var(--muted); font-size: 18px; cursor: pointer; line-height: 1; }
.icon-btn:hover { color: var(--text); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; }
.field input, .field textarea {
  width: 100%; padding: 11px 13px; font-size: 15px; font-family: inherit;
  border: 1px solid var(--border); border-radius: 10px;
  background: #fff; color: var(--text); outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.field input:focus, .field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(197, 139, 106, .15); }
.field textarea { resize: vertical; min-height: 90px; }
.file-wrap {
  display: flex; align-items: center; gap: 10px;
  border: 1px dashed var(--border); border-radius: 10px;
  padding: 10px 14px; cursor: pointer; background: #fff;
  transition: border-color .2s;
}
.file-wrap:hover { border-color: var(--accent); }
#imgLabel { font-size: 14px; color: var(--muted); }
#imgPreview { max-height: 80px; border-radius: 8px; border: 1px solid var(--border); }
.form-actions { display: flex; gap: 10px; margin-top: 4px; }
.btn {
  padding: 11px 22px; font-size: 15px; font-weight: 600;
  border: none; border-radius: 10px; cursor: pointer;
  transition: filter .2s, transform .1s;
}
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { filter: brightness(.95); }
.btn--ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.btn--ghost:hover { color: var(--text); border-color: var(--muted); }
.btn:active { transform: scale(.98); }

/* ---- 时间线 ---- */
.timeline { position: relative; padding-left: 28px; }
.timeline::before {
  content: ""; position: absolute;
  left: 7px; top: 8px; bottom: 8px; width: 2px;
  background: linear-gradient(var(--border), var(--accent-2));
  border-radius: 2px;
}
.entry {
  position: relative; margin-bottom: 22px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px;
  box-shadow: var(--shadow);
  transition: box-shadow .2s, transform .2s;
  animation: fadeUp .45s ease both;
}
.entry:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.entry::before {
  content: ""; position: absolute;
  left: -26px; top: 24px; width: 14px; height: 14px;
  border-radius: 50%; background: var(--accent);
  border: 3px solid var(--bg-1); box-shadow: 0 0 0 2px var(--accent);
}
.entry__date { font-size: 13px; color: var(--accent-2); font-weight: 700; letter-spacing: .5px; }
.entry__title { font-family: Georgia, "Songti SC", serif; font-size: 20px; font-weight: 600; margin: 4px 0 8px; }
.entry__text { margin: 0; white-space: pre-wrap; word-break: break-word; }
.entry__img {
  width: 100%; border-radius: 10px; margin: 4px 0 12px;
  border: 1px solid var(--border); display: block;
  cursor: zoom-in; background: #fff;
}
.entry__del {
  margin-top: 12px; background: none;
  border: 1px solid var(--border); color: var(--muted);
  font-size: 12px; padding: 4px 14px; border-radius: 20px; cursor: pointer;
  transition: color .2s, border-color .2s;
}
.entry__del:hover { color: var(--danger); border-color: var(--danger); }

.empty { text-align: center; color: var(--muted); padding: 40px 0; }
.count { text-align: center; color: var(--muted); font-size: 13px; margin-top: 8px; }

.foot {
  margin-top: 40px; padding-top: 22px;
  border-top: 1px solid var(--border); text-align: center;
}
.foot p { margin: 0; color: var(--muted); font-size: 13px; }

/* ---- 浮动新增按钮 ---- */
.fab {
  position: fixed; right: 28px; bottom: 28px; z-index: 60;
  width: 56px; height: 56px; border-radius: 50%;
  border: none; background: var(--accent); color: #fff;
  font-size: 30px; line-height: 1; cursor: pointer;
  box-shadow: 0 8px 24px rgba(197, 139, 106, .45);
  transition: transform .2s, box-shadow .2s, background .2s;
}
.fab:hover { transform: translateY(-3px) scale(1.06); box-shadow: 0 12px 28px rgba(197, 139, 106, .55); background: var(--accent-dark); }
.fab:active { transform: scale(.96); }

/* ---- 动画 ---- */
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fadeDown { from { opacity: 0; transform: translateY(-14px); } to { opacity: 1; transform: none; } }

@media (max-width: 520px) {
  .page { padding: 18px 16px 96px; }
  .head h1 { font-size: 28px; letter-spacing: 3px; }
  .form-row { grid-template-columns: 1fr; }
  .entry { padding: 16px; }
  .fab { right: 20px; bottom: 20px; width: 52px; height: 52px; }
}
