:root {
  --rose-50: #fff7f8;
  --rose-100: #ffedf1;
  --rose-200: #ffd8e2;
  --rose-300: #ffb9cb;
  --rose-400: #f98aa7;
  --rose-500: #ec6a8e;
  --rose-600: #d64d74;
  --ink: #3a2a31;
  --ink-soft: #6d5760;
  --muted: #9c8791;
  --card: rgba(255, 255, 255, 0.76);
  --line: rgba(214, 77, 116, 0.12);
  --shadow: 0 20px 45px -28px rgba(190, 60, 100, 0.55);
  --radius: 22px;
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1100px 620px at 12% -8%, #ffe3ea 0%, transparent 60%),
    radial-gradient(900px 560px at 96% 4%, #ffeef4 0%, transparent 62%),
    linear-gradient(168deg, #fff8f9 0%, #fff1f4 46%, #fdf3f7 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }

/* 漂浮的心 */
.sky { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.sky i {
  position: absolute;
  bottom: -40px;
  width: 14px; height: 14px;
  background: var(--rose-300);
  opacity: 0.35;
  transform: rotate(45deg);
  border-radius: 3px 0 0 3px;
  animation: float 26s linear infinite;
}
.sky i::before, .sky i::after {
  content: ""; position: absolute; width: 14px; height: 14px; border-radius: 50%; background: inherit;
}
.sky i::before { top: -7px; left: 0; }
.sky i::after { left: 7px; top: 0; }
.sky i:nth-child(1) { left: 8%; animation-duration: 24s; animation-delay: 0s; transform: rotate(45deg) scale(0.7); }
.sky i:nth-child(2) { left: 24%; animation-duration: 32s; animation-delay: -6s; transform: rotate(45deg) scale(1.1); }
.sky i:nth-child(3) { left: 46%; animation-duration: 28s; animation-delay: -12s; transform: rotate(45deg) scale(0.55); }
.sky i:nth-child(4) { left: 66%; animation-duration: 36s; animation-delay: -3s; transform: rotate(45deg) scale(0.9); }
.sky i:nth-child(5) { left: 82%; animation-duration: 30s; animation-delay: -18s; transform: rotate(45deg) scale(0.65); }
.sky i:nth-child(6) { left: 94%; animation-duration: 40s; animation-delay: -9s; transform: rotate(45deg) scale(0.8); }
@keyframes float {
  0% { transform: translateY(0) rotate(45deg); opacity: 0; }
  10% { opacity: 0.35; }
  100% { transform: translateY(-110vh) rotate(45deg); opacity: 0; }
}

/* ---------- 口令锁 ---------- */
.lock {
  position: fixed; inset: 0; z-index: 40;
  display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(700px 500px at 30% 20%, #ffdfe8, transparent 60%),
    radial-gradient(700px 520px at 76% 78%, #ffe9f4, transparent 60%),
    linear-gradient(160deg, #fff9fa, #ffeff4);
}
.lock[hidden] { display: none; }
.lock-card {
  width: min(380px, 100%);
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 28px;
  padding: 34px 28px 26px;
  text-align: center;
  box-shadow: 0 30px 70px -30px rgba(200, 70, 110, 0.5);
  backdrop-filter: blur(18px);
  animation: rise 0.5s ease both;
}
.lock-heart { font-size: 40px; line-height: 1; animation: beat 1.8s ease-in-out infinite; }
.lock-card h1 { font-size: 21px; margin: 12px 0 6px; }
.lock-sub { color: var(--muted); font-size: 13px; margin: 0 0 20px; }
.lock-card form { display: grid; gap: 10px; }
.lock-card input {
  height: 46px; border-radius: 14px; border: 1px solid var(--line);
  background: #fff; padding: 0 16px; outline: none; letter-spacing: 2px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.lock-card input:focus { border-color: var(--rose-300); box-shadow: 0 0 0 4px rgba(255, 185, 203, 0.3); }
.lock-card button {
  height: 46px; border: 0; border-radius: 14px; color: #fff; font-weight: 600; letter-spacing: 2px;
  background: linear-gradient(135deg, var(--rose-400), var(--rose-600));
  box-shadow: 0 14px 26px -14px rgba(214, 77, 116, 0.9);
  transition: transform 0.15s;
}
.lock-card button:active { transform: scale(0.98); }
.lock-err { min-height: 18px; margin: 12px 0 0; color: var(--rose-600); font-size: 12.5px; }
@keyframes beat { 0%, 100% { transform: scale(1); } 45% { transform: scale(1.12); } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ---------- 布局 ---------- */
#app {
  position: relative; z-index: 1;
  max-width: 960px;
  margin: 0 auto;
  padding: 0 16px 110px;
}

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding: 18px 4px 12px;
  position: sticky; top: 0; z-index: 20;
  background: linear-gradient(to bottom, rgba(255, 245, 247, 0.96) 62%, rgba(255, 245, 247, 0));
  backdrop-filter: blur(6px);
}
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand-heart {
  width: 40px; height: 40px; border-radius: 14px; display: grid; place-items: center;
  font-size: 19px;
  background: linear-gradient(140deg, #ffe6ee, #ffd3e1);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.9), 0 8px 18px -12px rgba(214, 77, 116, 0.8);
}
.brand-text { display: grid; line-height: 1.25; min-width: 0; }
.brand-text strong { font-size: 15.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text small { font-size: 11.5px; color: var(--muted); letter-spacing: 0.02em; }

.topbar-right { display: flex; align-items: center; gap: 8px; }
.me-chip {
  font-size: 12.5px; font-weight: 600; color: var(--rose-600);
  padding: 6px 12px; border-radius: 999px;
  background: linear-gradient(135deg, #ffe6ee, #ffd3e1);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.9);
  white-space: nowrap;
}
.identity-chip {
  display: inline-flex; align-items: center; height: 42px; padding: 0 14px;
  border-radius: 13px; border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.85);
  font-size: 13px; color: var(--ink-soft); white-space: nowrap;
}

.ghost-btn {
  border: 1px solid var(--line); background: rgba(255, 255, 255, 0.7);
  height: 38px; min-width: 38px; padding: 0 12px; border-radius: 12px;
  color: var(--ink-soft); font-size: 14px;
  transition: background 0.2s, transform 0.15s;
}
.ghost-btn:hover { background: #fff; }
.ghost-btn:active { transform: scale(0.96); }

.tabs {
  display: flex; gap: 4px; padding: 5px; margin: 4px 0 18px;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 1 0 auto; border: 0; background: transparent; color: var(--ink-soft);
  padding: 9px 18px; border-radius: 12px; font-size: 14px; white-space: nowrap;
  transition: background 0.25s, color 0.25s, box-shadow 0.25s;
}
.tab.is-active {
  background: linear-gradient(135deg, var(--rose-400), var(--rose-600));
  color: #fff; font-weight: 600;
  box-shadow: 0 12px 22px -14px rgba(214, 77, 116, 0.95);
}

.panel { display: none; animation: fadeUp 0.45s ease both; }
.panel.is-active { display: block; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.card {
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  padding: 20px;
  margin-bottom: 14px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.card-head h2 { font-size: 15.5px; }

/* ---------- 计时器 ---------- */
.hero { position: relative; overflow: hidden; text-align: center; padding: 30px 18px 26px; }
.hero-glow {
  position: absolute; inset: -60% -10% auto; height: 220px;
  background: radial-gradient(50% 100% at 50% 100%, rgba(255, 154, 183, 0.45), transparent 70%);
  pointer-events: none;
}
.hero-label { margin: 0 0 10px; font-size: 12.5px; letter-spacing: 0.32em; color: var(--rose-500); text-transform: uppercase; }
.timer { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; align-items: end; }
.unit { display: grid; gap: 2px; position: relative; }
.unit b {
  font-size: clamp(26px, 7.6vw, 42px);
  font-weight: 600;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(150deg, #e8608a, #b93a63);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  line-height: 1.15;
}
.unit span { font-size: 11px; color: var(--muted); letter-spacing: 0.2em; }
.hero-tag { margin: 16px 0 0; font-size: 13px; color: var(--ink-soft); }

.grid2 { display: grid; gap: 14px; grid-template-columns: 1fr; margin-bottom: 14px; }
@media (min-width: 640px) { .grid2 { grid-template-columns: 1fr 1fr; } .grid2 .card { margin-bottom: 0; } }

.mini-head { display: flex; align-items: center; justify-content: space-between; font-size: 12.5px; color: var(--muted); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--rose-300); box-shadow: 0 0 0 3px rgba(255, 185, 203, 0.28); }
.mini-body { margin-top: 10px; font-size: 15px; }
.mini-body.empty { color: var(--muted); font-size: 13px; }

.countdown-num { font-size: 30px; font-weight: 600; color: var(--rose-600); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.countdown-num small { font-size: 12.5px; font-weight: 400; color: var(--muted); margin-left: 4px; letter-spacing: 0; }

/* ---------- 留言 ---------- */
.composer { display: grid; gap: 10px; }
.composer-row { display: flex; gap: 10px; flex-wrap: wrap; }
.composer-row > input, .composer-row > select {
  flex: 1 1 160px; min-width: 0;
}
input[type="text"], input[type="date"], select, textarea {
  border: 1px solid var(--line); background: rgba(255, 255, 255, 0.85);
  border-radius: 13px; padding: 11px 13px; outline: none; font-size: 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
input:focus, select:focus, textarea:focus { border-color: var(--rose-300); box-shadow: 0 0 0 4px rgba(255, 185, 203, 0.25); }
textarea { resize: vertical; min-height: 84px; line-height: 1.6; }
.chip-select { max-width: 150px; }
.composer-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.counter { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

.primary-btn {
  border: 0; border-radius: 13px; padding: 10px 22px; color: #fff; font-size: 14px; font-weight: 600;
  background: linear-gradient(135deg, var(--rose-400), var(--rose-600));
  box-shadow: 0 14px 24px -16px rgba(214, 77, 116, 0.95);
  transition: transform 0.15s, filter 0.2s;
}
.primary-btn:active { transform: scale(0.97); }
.primary-btn:disabled { filter: grayscale(0.3); opacity: 0.6; }
.link-btn { border: 0; background: none; color: var(--rose-500); font-size: 12.5px; padding: 2px; }
.upload-btn {
  display: inline-flex; align-items: center; height: 36px; padding: 0 16px;
  border-radius: 11px; font-size: 13px; font-weight: 600; color: #fff;
  background: linear-gradient(135deg, var(--rose-400), var(--rose-600));
  box-shadow: 0 12px 22px -16px rgba(214, 77, 116, 0.95);
  cursor: pointer; transition: transform 0.15s;
}
.upload-btn:active { transform: scale(0.97); }
.hint { font-size: 12px; color: var(--muted); margin: 0 0 12px; }

.msg-list { display: grid; gap: 10px; }
.msg {
  display: grid; grid-template-columns: 36px 1fr auto; gap: 10px; align-items: start;
  padding: 12px 12px; border-radius: 15px;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.9);
  animation: fadeUp 0.35s ease both;
}
.msg-avatar {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  font-size: 13px; font-weight: 600; color: #fff;
  background: linear-gradient(140deg, #ffa9c0, #e2607f);
}
.msg-body { min-width: 0; }
.msg-meta { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--muted); }
.msg-author { color: var(--ink); font-weight: 600; font-size: 12.5px; }
.msg-text { margin: 3px 0 0; font-size: 14px; white-space: pre-wrap; word-break: break-word; }
.msg-del {
  border: 0; background: none; color: var(--muted); font-size: 13px; padding: 2px 4px;
  opacity: 0; transition: opacity 0.2s, color 0.2s;
}
.msg:hover .msg-del, .msg:focus-within .msg-del { opacity: 1; }
.msg-del:hover { color: var(--rose-600); }
.msg-list.compact .msg:nth-child(n+4) { display: none; }

/* ---------- 相册 ---------- */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 8px; }
.photo {
  position: relative; aspect-ratio: 1; width: 100%; margin: 0; border-radius: 14px; overflow: hidden;
  background: linear-gradient(140deg, #ffe7ee, #ffd9e5);
  border: 1px solid rgba(255, 255, 255, 0.9);
  animation: fadeUp 0.35s ease both;
}
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.35s ease; }
.photo:hover img { transform: scale(1.05); }
.photo-del {
  position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border-radius: 50%;
  border: 0; background: rgba(40, 20, 28, 0.45); color: #fff; font-size: 12px; line-height: 1;
  display: grid; place-items: center; opacity: 0; transition: opacity 0.2s;
  backdrop-filter: blur(4px);
}
.photo:hover .photo-del { opacity: 1; }
.photo-cap {
  position: absolute; inset: auto 0 0; padding: 18px 8px 6px;
  font-size: 11px; color: #fff; text-align: left;
  background: linear-gradient(to top, rgba(40, 20, 28, 0.55), transparent);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.empty-tip { color: var(--muted); font-size: 13px; text-align: center; padding: 26px 0 8px; }
.photo-more { display: flex; align-items: center; justify-content: center; gap: 12px; padding-top: 14px; }
.photo-more .hint { margin: 0; }

/* ---------- 纪念日 ---------- */
.anni-list { display: grid; gap: 10px; }
.anni {
  display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: center;
  padding: 13px 14px; border-radius: 15px;
  background: rgba(255, 255, 255, 0.62); border: 1px solid rgba(255, 255, 255, 0.9);
}
.anni-title { font-size: 14px; font-weight: 600; }
.anni-note { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.anni-count { text-align: right; font-variant-numeric: tabular-nums; }
.anni-count b { font-size: 19px; color: var(--rose-600); }
.anni-count span { font-size: 11px; color: var(--muted); margin-left: 2px; }
.anni-del { border: 0; background: none; color: var(--muted); font-size: 13px; }
.switch { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-soft); white-space: nowrap; }
.switch input { accent-color: var(--rose-500); }

/* ---------- 心情 ---------- */
.mood-board { display: grid; gap: 14px; }
@media (min-width: 640px) { .mood-board { grid-template-columns: 1fr 1fr; } }
.mood-person {
  padding: 14px; border-radius: 16px; background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.9);
}
.mood-person-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.mood-person-head strong { font-size: 13.5px; }
.mood-current { font-size: 22px; }
.mood-options { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.mood-opt {
  aspect-ratio: 1; width: 100%; border: 1px solid transparent; border-radius: 12px; background: rgba(255, 255, 255, 0.75);
  font-size: 19px; display: grid; place-items: center; transition: transform 0.15s, border-color 0.2s, background 0.2s;
}
.mood-opt:hover { transform: translateY(-2px); }
.mood-opt.is-on { border-color: var(--rose-300); background: #fff; box-shadow: 0 8px 18px -12px rgba(214, 77, 116, 0.9); }
.mood-opt:disabled { opacity: 0.45; cursor: default; }
.mood-opt:disabled:hover { transform: none; }
.mood-person.is-me { border-color: rgba(236, 106, 142, 0.35); box-shadow: 0 12px 26px -20px rgba(214, 77, 116, 0.9); }
.mood-week { display: grid; gap: 8px; }
.mood-day { display: grid; grid-template-columns: 70px 1fr 1fr; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); }
.mood-day .who { display: flex; gap: 6px; }
.mood-pill { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 10px; background: rgba(255, 255, 255, 0.75); font-size: 15px; }

/* ---------- 弹层 ---------- */
.modal {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px;
  background: rgba(58, 42, 49, 0.32); backdrop-filter: blur(6px);
}
.modal[hidden] { display: none; }
.modal-card {
  width: min(420px, 100%); background: #fffafb; border-radius: 24px; padding: 22px;
  box-shadow: 0 40px 80px -40px rgba(90, 30, 50, 0.6);
  animation: rise 0.3s ease both;
}
.settings-form { display: grid; gap: 12px; }
.settings-form label { display: grid; gap: 6px; font-size: 12.5px; color: var(--ink-soft); }
.settings-form input { width: 100%; }

.lightbox {
  position: fixed; inset: 0; z-index: 60; display: grid; place-items: center;
  background: rgba(30, 18, 24, 0.9); padding: 20px;
}
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 100%; max-height: 88vh; border-radius: 12px; box-shadow: 0 30px 60px -20px #000; }
.lightbox-close {
  position: absolute; top: 18px; right: 18px; width: 40px; height: 40px; border-radius: 50%;
  border: 0; background: rgba(255, 255, 255, 0.16); color: #fff; font-size: 16px;
}

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: rgba(58, 42, 49, 0.92); color: #fff; font-size: 13px;
  padding: 10px 18px; border-radius: 999px; z-index: 70;
  box-shadow: 0 18px 30px -18px rgba(0, 0, 0, 0.6);
  animation: rise 0.25s ease both;
}
.toast[hidden] { display: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}
