:root {
  --bg: #fff5f7;
  --card: #ffffff;
  --ink: #4a3b3f;
  --muted: #a08b92;
  --primary: #f45b7a;
  --primary-dark: #d63a5e;
  --primary-soft: #ffe3ea;
  --accent: #ff9f68;
  --border: #f4dce2;
  --shadow: 0 8px 30px rgba(214, 58, 94, 0.10);
  --radius: 16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  color: var(--ink);
  background: linear-gradient(160deg, #fff5f7 0%, #ffe9ee 55%, #fff1e6 100%);
  min-height: 100vh;
}

.hidden { display: none !important; }

/* ---------- 进入密码门 ---------- */
.gate {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #fff5f7, #ffe4e9);
  z-index: 100;
}
.gate-card {
  background: var(--card);
  padding: 40px 36px;
  border-radius: 24px;
  box-shadow: var(--shadow);
  text-align: center;
  width: min(340px, 90vw);
}
.gate-heart { font-size: 48px; }
.gate-card h2 { margin: 8px 0 4px; }
.gate-hint { color: var(--muted); margin: 0 0 20px; }
.gate-card input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 16px;
  margin-bottom: 12px;
  outline: none;
}
.gate-card input:focus { border-color: var(--primary); }
.gate-error { color: var(--primary-dark); margin: 12px 0 0; font-size: 14px; }

/* ---------- 顶部栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; font-size: 17px; white-space: nowrap; }
.identity-toggle { display: flex; gap: 6px; }
.id-btn {
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--muted);
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 13px;
}
.id-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.nav { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.nav-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 8px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
}
.nav-btn:hover { background: var(--primary-soft); }
.nav-btn.active { background: var(--primary); color: #fff; }

/* ---------- 视图容器 ---------- */
.view { max-width: 860px; margin: 0 auto; padding: 24px 20px 60px; }
.loading { text-align: center; color: var(--muted); padding: 40px 0; }

/* ---------- 通用 ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
h2 { margin: 0 0 16px; font-size: 20px; }
.muted { color: var(--muted); font-size: 13px; }
.empty { text-align: center; color: var(--muted); padding: 32px 0; }

.btn, .btn-primary, .btn-ghost, .btn-danger {
  border: none;
  cursor: pointer;
  border-radius: 10px;
  padding: 9px 16px;
  font-size: 14px;
  transition: transform .05s ease, opacity .15s ease;
}
.btn:active, .btn-primary:active, .btn-ghost:active, .btn-danger:active { transform: scale(.97); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: var(--primary-soft); color: var(--primary-dark); }
.btn-danger { background: #fff0f2; color: #d6304b; }
.btn-small { padding: 5px 10px; font-size: 12px; border-radius: 8px; }

.chip {
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--muted);
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 13px;
}
.chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; }
.field input, .field textarea, .field select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  background: #fff;
}
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--primary); }
.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; }
.checkbox { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.checkbox input { width: auto; }

/* ---------- 首页 ---------- */
.hero { text-align: center; padding: 48px 20px; }
.hero-heart { font-size: 60px; animation: beat 1.6s infinite; }
@keyframes beat { 0%,100%{transform:scale(1)} 12%{transform:scale(1.15)} 24%{transform:scale(1)} }
.hero-names { font-size: 22px; font-weight: 700; margin: 12px 0; }
.hero-days { font-size: 18px; margin: 8px 0; }
.hero-days b { font-size: 44px; color: var(--primary); }
.hero-next { color: var(--muted); margin: 6px 0; }
.hero-date { color: var(--muted); font-size: 13px; margin-top: 16px; }

/* ---------- 愿望清单 ---------- */
.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.wish-list { display: flex; flex-direction: column; gap: 12px; }
.wish-item { background: var(--card); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.wish-item.surprise { border-left: 4px solid var(--accent); }
.wish-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.wish-title { font-size: 16px; font-weight: 600; }
.badge { font-size: 11px; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.badge-wish { background: #eef1ff; color: #5a6bdc; }
.badge-claimed { background: #fff3e0; color: #e08a1e; }
.badge-done { background: #e7f6ee; color: #2f9e63; }
.badge-priority { background: var(--primary-soft); color: var(--primary-dark); }
.badge-surprise { background: #fff0e8; color: var(--accent); }
.wish-desc { margin: 8px 0 0; font-size: 14px; color: var(--ink); white-space: pre-wrap; }
.wish-meta { margin-top: 8px; font-size: 12px; color: var(--muted); }
.wish-meta a { color: var(--primary); }
.wish-actions { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- 相册 ---------- */
.album-bar { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.photo-card { background: var(--card); border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); position: relative; }
.photo-card img { width: 100%; aspect-ratio: 1/1; object-fit: cover; display: block; }
.photo-cap { padding: 6px 10px; font-size: 12px; color: var(--muted); }
.photo-del {
  position: absolute; top: 6px; right: 6px;
  background: rgba(0,0,0,.45); color: #fff; border: none;
  width: 26px; height: 26px; border-radius: 50%; cursor: pointer; font-size: 14px;
}

/* ---------- 留言板 ---------- */
.board { display: flex; flex-direction: column; gap: 12px; }
.msg { background: var(--card); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.msg-meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.msg-meta .author { font-weight: 600; color: var(--primary); }
.msg-content { font-size: 15px; white-space: pre-wrap; }

/* ---------- 设置 ---------- */
.settings-form { display: flex; flex-direction: column; gap: 0; }
.avatar-row { display: flex; align-items: center; gap: 10px; }
.avatar-preview { width: 40px; height: 40px; border-radius: 50%; background: var(--primary-soft); display: flex; align-items: center; justify-content: center; font-size: 20px; overflow: hidden; }
.avatar-preview img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- toast ---------- */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 14px;
  z-index: 200;
  opacity: 0;
  transition: opacity .2s ease;
}
.toast.show { opacity: 1; }
