:root {
  --bg: #f6f1e8;
  --card: #fffdf8;
  --ink: #2b2621;
  --ink-2: #5c534a;
  --muted: #9b9086;
  --line: #eae0d2;
  --accent: #c0644a;
  --accent-soft: #f8e3d9;
  --sage: #7d9a86;
  --sage-soft: #e3ece4;
  --gold: #cf9c55;
  --gold-soft: #f7ecd8;
  --radius: 20px;
  --shadow: 0 1px 2px rgba(74, 52, 30, .04), 0 10px 30px -16px rgba(74, 52, 30, .22);
}

* { box-sizing: border-box; }

/* 作者样式里的 display 会盖掉 UA 的 [hidden]{display:none}，必须显式声明 */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(1100px 560px at 8% -8%, #fdf6e7 0%, transparent 62%),
    radial-gradient(900px 520px at 102% 2%, #eaf1ec 0%, transparent 58%),
    var(--bg);
  font: 15px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, .serif {
  font-family: "Songti SC", "Noto Serif SC", "Source Han Serif SC", Georgia, "Times New Roman", serif;
  font-weight: 600;
  letter-spacing: .01em;
  margin: 0;
}

button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
::selection { background: var(--accent-soft); }

/* ---------- 通用 ---------- */

.wrap {
  max-width: 960px;
  margin: 0 auto;
  padding: 26px 20px 64px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
}

.card-title {
  font-size: 17px;
  margin-bottom: 14px;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.tiny { font-size: 12px; }
.muted { color: var(--muted); }

.line {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 10px 13px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.line::placeholder { color: #b9ada1; }
.line:focus {
  border-color: #e0c3b4;
  box-shadow: 0 0 0 3px rgba(192, 100, 74, .09);
}
textarea.line { resize: vertical; line-height: 1.55; }

.primary {
  background: var(--accent);
  color: #fff;
  border-radius: 999px;
  padding: 10px 22px;
  font-weight: 600;
  letter-spacing: .02em;
  transition: transform .12s, filter .15s, box-shadow .15s;
  box-shadow: 0 6px 16px -8px rgba(192, 100, 74, .8);
  white-space: nowrap;
}
.primary:hover { filter: brightness(1.05); }
.primary:active { transform: translateY(1px) scale(.99); }
.primary:disabled { opacity: .55; cursor: default; }

.ghost {
  border-radius: 999px;
  padding: 9px 16px;
  color: var(--ink-2);
  border: 1px solid var(--line);
  background: #fff;
  transition: background .15s, border-color .15s;
}
.ghost:hover { background: #faf6ef; border-color: #ded2c1; }
.ghost.icon { padding: 8px 11px; font-size: 15px; }
.small { padding: 7px 14px; font-size: 13.5px; }
.wide { width: 100%; justify-content: center; }

.spacer { flex: 1; }

/* ---------- 口令 / 身份 ---------- */

.screen {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.lock-card {
  width: min(430px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 40px 30px 34px;
  box-shadow: var(--shadow);
  text-align: center;
  animation: rise .45s cubic-bezier(.2, .8, .3, 1) both;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

.spin {
  color: var(--muted);
  font-size: 13px;
  letter-spacing: .18em;
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: .35; }
  50% { opacity: .9; }
}

.lock-emoji { font-size: 40px; margin-bottom: 10px; }.lock-card h1 { font-size: 27px; }
.lock-card .sub { color: var(--muted); margin: 8px 0 26px; font-size: 14px; }
.lock-card form { display: grid; gap: 12px; }
.lock-card input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 13px 16px;
  text-align: center;
  letter-spacing: .06em;
  outline: none;
  background: #fff;
}
.lock-card input:focus { border-color: #e0c3b4; box-shadow: 0 0 0 3px rgba(192,100,74,.09); }
.err { color: #b8452f; font-size: 13px; min-height: 20px; margin: 12px 0 0; }

.who-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.who-btn {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 20px 10px;
  background: #fff;
  display: grid;
  gap: 6px;
  justify-items: center;
  transition: transform .15s, border-color .15s, box-shadow .15s;
}
.who-btn:hover { transform: translateY(-2px); border-color: #e0c3b4; box-shadow: var(--shadow); }
.who-btn .em { font-size: 30px; }
.who-btn .nm { font-size: 14px; color: var(--ink-2); }

.who-note {
  margin: 20px 0 0;
  font-size: 12.5px;
  line-height: 1.75;
  color: var(--muted);
}

/* ---------- 顶栏 ---------- */

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: "Songti SC", Georgia, serif;
  font-size: 18px;
  letter-spacing: .04em;
}
.dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--sage);
  box-shadow: 0 0 0 4px var(--sage-soft);
  transition: background .3s, box-shadow .3s;
}
.dot.off { background: #c9b7a4; box-shadow: 0 0 0 4px #efe8dd; }
.top-right { display: flex; align-items: center; gap: 10px; }
.sync { font-size: 12px; color: var(--muted); }

/* ---------- 双时区 ---------- */

.clocks {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 20px 18px;
  margin-bottom: 14px;
}
.clock { text-align: center; display: grid; gap: 3px; justify-items: center; }
.clock .ce { font-size: 22px; line-height: 1; }
.clock .cn { font-size: 13px; color: var(--ink-2); letter-spacing: .03em; }
.clock .ct {
  font-size: 34px;
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
  line-height: 1.1;
  font-weight: 300;
}
.clock .cd { font-size: 12px; color: var(--muted); }
.clocks .mid {
  display: grid;
  gap: 6px;
  justify-items: center;
  padding: 0 6px;
}
.tz-diff {
  font-size: 12px;
  color: var(--ink-2);
  background: var(--gold-soft);
  border-radius: 999px;
  padding: 3px 10px;
  white-space: nowrap;
}

/* ---------- 见面倒计时 ---------- */

.meetup {
  background: linear-gradient(135deg, #fdf1e4, #f3f7f1);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 13px 18px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
}
.meetup b { font-weight: 600; color: var(--accent); }
.meetup .mt-date { margin-left: auto; font-size: 12px; color: var(--muted); text-align: right; }

/* ---------- 两列 ---------- */

.cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
  align-items: start;
}
.cols.second { grid-template-columns: 1.15fr .85fr; }

/* ---------- 小动物 ---------- */

.petcard { display: grid; gap: 14px; }
.pet-head { display: flex; align-items: center; gap: 14px; }
.pet-face {
  font-size: 46px;
  line-height: 1;
  width: 76px; height: 76px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, #fff6e6, #f4e6d2);
  border: 1px solid #efe0cb;
  transition: transform .25s;
}
.pet-face.happy { animation: bob 2.6s ease-in-out infinite; }
@keyframes bob {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-5px) rotate(2deg); }
}
.pet-name { font-size: 19px; }
.pet-mood { margin: 2px 0 0; font-size: 13.5px; color: var(--ink-2); }

.bars { display: grid; gap: 8px; }
.bar { display: grid; grid-template-columns: 34px 1fr 30px; align-items: center; gap: 9px; }
.bar .bl { font-size: 12px; color: var(--muted); }
.bar .track {
  height: 7px;
  border-radius: 999px;
  background: #f0e8db;
  overflow: hidden;
}
.bar .fill { display: block; height: 100%; border-radius: 999px; transition: width .5s cubic-bezier(.2,.8,.3,1); }
.bar .bv { font-size: 11.5px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.fill.h { background: linear-gradient(90deg, #e3b06a, #d8993f); }
.fill.hp { background: linear-gradient(90deg, #d98a72, #c0644a); }
.fill.e { background: linear-gradient(90deg, #9dbba6, #7d9a86); }

.pet-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.pet-actions button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 13px;
  padding: 9px 4px;
  font-size: 12.5px;
  color: var(--ink-2);
  transition: background .15s, transform .12s, border-color .15s;
  line-height: 1.35;
}
.pet-actions button:hover { background: #fdf7ee; border-color: #e6d6c2; }
.pet-actions button:active { transform: scale(.96); }
.pet-actions button:disabled { opacity: .5; }

.pet-log { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; }
.pet-log li { font-size: 12px; color: var(--muted); display: flex; gap: 6px; }
.pet-log li b { font-weight: 500; color: var(--ink-2); }

/* ---------- 今天 ---------- */

.today { display: grid; gap: 14px; }

.today-rows { display: grid; gap: 10px; }
.day-row {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 11px;
  padding: 11px 13px;
  border-radius: 14px;
  background: #fbf7f0;
  border: 1px solid #f0e7d9;
}
.day-row.me { background: #fdf6ef; border-color: #f1e0d2; }
.day-av {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  font-size: 20px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid var(--line);
}
.day-top { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.day-top b { font-size: 13.5px; font-weight: 600; }
.badge {
  font-size: 11px;
  border-radius: 999px;
  padding: 1px 8px;
  background: var(--sage-soft);
  color: #4d6b57;
}
.badge.off { background: #f2ece2; color: #a1937f; }
.day-streak { font-size: 11px; color: var(--gold); }
.day-mood { font-size: 17px; margin-left: auto; line-height: 1; }
.day-weather { font-size: 11.5px; color: var(--muted); }
.day-note { font-size: 13px; color: var(--ink-2); margin-top: 3px; word-break: break-word; }
.day-note.is-empty { color: #bdb1a3; font-style: italic; }

.editor {
  border-top: 1px dashed var(--line);
  padding-top: 14px;
  display: grid;
  gap: 9px;
}
.editor-label { font-size: 12px; color: var(--muted); letter-spacing: .04em; }

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}
.emoji-grid button {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  font-size: 20px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: #faf5ed;
  transition: transform .12s, background .15s, border-color .15s;
}
.emoji-grid button:hover { transform: translateY(-2px); background: #fdf6ea; }
.emoji-grid button.on {
  background: var(--accent-soft);
  border-color: #e6bda9;
  box-shadow: 0 0 0 3px rgba(192, 100, 74, .1);
}

.editor-foot { display: flex; align-items: center; gap: 8px; }
.editor-foot .primary { margin-left: auto; }
.hint { margin: 0; }

/* ---------- 留言 ---------- */

.feed { margin-bottom: 14px; }
.feed-list {
  max-height: 420px;
  overflow-y: auto;
  display: grid;
  gap: 2px;
  padding-right: 4px;
  scrollbar-width: thin;
}
.feed-day {
  font-size: 11.5px;
  color: var(--muted);
  text-align: center;
  margin: 12px 0 6px;
  position: relative;
}
.feed-day::before,
.feed-day::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 26%;
  height: 1px;
  background: var(--line);
}
.feed-day::before { left: 0; }
.feed-day::after { right: 0; }

.msg {
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 9px;
  padding: 7px 8px;
  border-radius: 12px;
  transition: background .15s;
  position: relative;
}
.msg:hover { background: #fbf7f0; }
.msg-av {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  font-size: 16px;
  border-radius: 50%;
  background: #f6efe4;
  border: 1px solid var(--line);
}
.msg-top { display: flex; align-items: baseline; gap: 8px; }
.msg-top b { font-size: 12.5px; font-weight: 600; }
.msg-top span { font-size: 11px; color: var(--muted); }
.msg-text { font-size: 14px; line-height: 1.6; word-break: break-word; white-space: pre-wrap; }
.msg-del {
  position: absolute;
  right: 6px; top: 6px;
  font-size: 11px;
  color: #c4b7a8;
  opacity: 0;
  padding: 2px 6px;
  border-radius: 8px;
  transition: opacity .15s, background .15s;
}
.msg:hover .msg-del { opacity: 1; }
.msg-del:hover { background: #f2e9dd; color: var(--accent); }
.empty { color: #bdb1a3; font-size: 13px; text-align: center; padding: 18px 0; margin: 0; }

.composer {
  border-top: 1px solid var(--line);
  margin-top: 12px;
  padding-top: 12px;
  display: grid;
  gap: 8px;
}
.composer-emojis { display: flex; gap: 5px; flex-wrap: wrap; }
.composer-emojis button {
  font-size: 16px;
  border-radius: 9px;
  padding: 3px 6px;
  background: #faf5ed;
  border: 1px solid transparent;
  transition: transform .12s, border-color .15s;
}
.composer-emojis button:hover { transform: translateY(-2px); border-color: #e6d6c2; }
.composer-row { display: flex; gap: 8px; }

/* ---------- 愿望 ---------- */

.inline-add { display: flex; gap: 8px; margin-bottom: 12px; }
.inline-add .primary { align-self: stretch; }

.wish-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; max-height: 300px; overflow-y: auto; }
.wish {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  align-items: start;
  gap: 8px;
  padding: 7px 6px;
  border-radius: 10px;
  transition: background .15s;
}
.wish:hover { background: #fbf7f0; }
.wish .check {
  width: 20px; height: 20px;
  border-radius: 7px;
  border: 1.5px solid #ddd0be;
  display: grid; place-items: center;
  font-size: 12px;
  color: #fff;
  margin-top: 2px;
  transition: background .15s, border-color .15s;
}
.wish.done .check { background: var(--sage); border-color: var(--sage); }
.wish-text { font-size: 13.5px; line-height: 1.5; word-break: break-word; }
.wish.done .wish-text { color: var(--muted); text-decoration: line-through; text-decoration-color: #d8cbbb; }
.wish-by { font-size: 12px; opacity: .65; }

/* ---------- 时光胶囊 ---------- */

.capsule-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; max-height: 320px; overflow-y: auto; }
.capsule {
  border-radius: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: #fbf7f0;
  font-size: 12.5px;
}
.capsule .cap-top { display: flex; align-items: center; gap: 7px; color: var(--ink-2); }
.capsule .cap-top .when { margin-left: auto; color: var(--muted); font-size: 11px; }
.capsule.open { background: #fdf6ef; border-color: #f0dccb; }
.capsule .cap-body {
  margin-top: 7px;
  font-size: 13.5px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--ink);
}

/* ---------- 页脚 / 提示 ---------- */

.foot {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  padding: 22px 0 6px;
  display: grid;
  gap: 3px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(10px);
  background: #2b2621;
  color: #fdf9f3;
  font-size: 13px;
  padding: 10px 18px;
  border-radius: 999px;
  box-shadow: 0 12px 30px -12px rgba(0,0,0,.5);
  opacity: 0;
  transition: opacity .2s, transform .2s;
  z-index: 50;
  max-width: 84vw;
  text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 设置弹窗 ---------- */

.modal {
  position: fixed;
  inset: 0;
  background: rgba(43, 38, 33, .32);
  backdrop-filter: blur(3px);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 40;
}
.modal-card {
  width: min(520px, 100%);
  max-height: 88dvh;
  overflow-y: auto;
  background: var(--card);
  border-radius: 24px;
  padding: 26px 26px 20px;
  box-shadow: 0 30px 60px -24px rgba(60, 42, 24, .45);
  animation: rise .3s cubic-bezier(.2,.8,.3,1) both;
}
.modal-card h2 { font-size: 20px; margin-bottom: 16px; }
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.form label { display: grid; gap: 5px; font-size: 12px; color: var(--muted); }
.modal-foot { display: flex; align-items: center; gap: 8px; margin-top: 18px; }

/* ---------- 手机 ---------- */

@media (max-width: 720px) {
  .wrap { padding: 18px 14px 48px; }
  .cols, .cols.second { grid-template-columns: 1fr; }
  .clocks { padding: 16px 10px; }
  .clock .ct { font-size: 27px; }
  .card { padding: 17px 16px; border-radius: 18px; }
  .pet-actions { grid-template-columns: repeat(2, 1fr); }
  .form { grid-template-columns: 1fr; }
  .brand { font-size: 16px; }
  .meetup { flex-wrap: wrap; gap: 8px; }
  .meetup .mt-date { margin-left: 0; width: 100%; text-align: left; }
  .feed-list { max-height: 60vh; }
}

/* 触屏设备没有 hover，删除按钮常显一半透明度 */
@media (hover: none) {
  .msg-del { opacity: .45; }
}
