*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.65;
  background: var(--bg); -webkit-tap-highlight-color: transparent;
}
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(520px 380px at 8% -4%, #ffe1e8 0%, transparent 70%),
    radial-gradient(480px 380px at 100% 8%, #ffeccf 0%, transparent 70%),
    radial-gradient(520px 420px at 50% 112%, #e6f5e6 0%, transparent 70%);
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
:focus-visible { outline: 2px solid var(--pink); outline-offset: 2px; }
h1, h2, h3, p { margin: 0; }
svg.i { width: 1.25em; height: 1.25em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
svg.i.on { fill: currentColor; }

/* ---------- 外壳 ---------- */
.shell { max-width: 560px; margin: 0 auto; padding: 0 16px calc(120px + env(safe-area-inset-bottom)); }
.top {
  position: sticky; top: 0; z-index: 20; display: flex; justify-content: center; align-items: center; gap: 10px;
  padding: calc(14px + env(safe-area-inset-top)) 0 12px;
  background: linear-gradient(var(--bg) 60%, transparent);
}
.couple { display: flex; align-items: center; gap: 4px; padding: 5px 14px 5px 5px; border-radius: 99px; background: var(--card); box-shadow: var(--shadow-sm); border: 1px solid var(--line); }
.couple .heart { color: var(--pink); font-size: 18px; animation: beat 2.4s ease-in-out infinite; }
.couple .av-btn { border-radius: 50%; transition: transform .25s var(--ease); }
.couple .av-btn:hover { transform: scale(1.08); }
.couple .name { font-size: 14px; color: var(--ink-2); margin: 0 6px 0 2px; }
.page { animation: rise .45s ease both; }
.page > * + * { margin-top: 16px; }
.page-title { font-size: 22px; padding: 4px 6px 0; display: flex; align-items: baseline; gap: 8px; }
.page-title small { font-size: 13px; color: var(--muted); }

.tabbar {
  position: fixed; left: 50%; bottom: calc(14px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 30;
  width: min(92vw, 480px); display: grid; grid-template-columns: repeat(var(--n, 4), 1fr); gap: 4px; padding: 6px;
  border-radius: 28px; background: rgba(255, 255, 255, .82); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--line); box-shadow: 0 16px 40px -12px rgba(214, 100, 135, .45);
}
.tab { text-decoration: none; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 6px; border-radius: 22px; color: var(--muted); font-size: 12px; transition: all .3s var(--ease); }
.tab svg.i { width: 22px; height: 22px; }
.tab.active { color: var(--pink-deep); background: var(--pink-soft); }
.tab.active svg.i { transform: translateY(-1px) scale(1.08); }

/* ---------- 通用组件 ---------- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow);
  padding: 18px; animation: rise .45s ease both; animation-delay: calc(var(--i, 0) * 50ms);
}
.btn {
  white-space: nowrap; flex: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 22px; border-radius: 99px;
  color: #fff; background: linear-gradient(135deg, #ffa3bb, var(--pink-deep)); box-shadow: 0 8px 18px -8px var(--pink-deep);
  transition: transform .2s var(--ease), filter .2s; font-size: 15px;
}
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: scale(.95); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.ghost { color: var(--ink-2); background: transparent; box-shadow: none; border: 1px solid var(--line); }
.btn.sm { padding: 6px 14px; font-size: 14px; }
.btn.danger { background: #fff; color: #d4577a; box-shadow: none; border: 1px solid var(--line); }
.input, .textarea {
  width: 100%; padding: 11px 16px; border-radius: var(--r-sm); border: 1px solid var(--line); background: #fff; outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.input:focus, .textarea:focus { border-color: var(--pink); box-shadow: 0 0 0 4px rgba(255, 143, 171, .15); }
.textarea { resize: none; min-height: 96px; line-height: 1.7; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { padding: 5px 14px; border-radius: 99px; font-size: 14px; background: #fff; border: 1px solid var(--line); color: var(--ink-2); transition: all .25s var(--ease); white-space: nowrap; }
.chip.on { background: var(--pink-soft); border-color: var(--pink); color: var(--pink-deep); transform: translateY(-1px); }
.empty { text-align: center; color: var(--muted); padding: 36px 0; }
.empty .big { font-size: 40px; display: block; margin-bottom: 6px; }

.avatar {
  --s: 40px; width: var(--s); height: var(--s); border-radius: 50%; flex: none; display: grid; place-items: center;
  font-size: calc(var(--s) * .55); background: var(--pink-soft) center / cover no-repeat; border: 2px solid #fff; box-shadow: 0 2px 8px -3px rgba(0, 0, 0, .25);
}
.avatar.boy { background-color: var(--boy-soft); }
.avatar.girl { background-color: var(--girl-soft); }

/* 底部弹层 */
.backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(75, 58, 64, .32); backdrop-filter: blur(3px); animation: fade .25s both; display: flex; align-items: flex-end; justify-content: center; }
.sheet {
  width: min(100%, 520px); max-height: 86vh; overflow: auto; background: #fffaf7; border-radius: 28px 28px 0 0; padding: 22px 20px calc(24px + env(safe-area-inset-bottom));
  animation: slide .35s var(--ease) both; box-shadow: 0 -10px 40px -10px rgba(0, 0, 0, .2);
}
.sheet > * + * { margin-top: 14px; }
.sheet h3 { font-size: 18px; text-align: center; }
@media (min-width: 600px) { .backdrop { align-items: center; } .sheet { border-radius: 28px; } }
.toast {
  position: fixed; top: calc(18px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 99; padding: 9px 20px; border-radius: 99px;
  background: var(--ink); color: #fff; font-size: 14px; box-shadow: var(--shadow); animation: toast 2.4s ease both; white-space: nowrap;
}

/* ---------- 登录 ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login .card { width: min(100%, 380px); text-align: center; padding: 34px 26px; }
.login h1 { font-size: 26px; }
.login .sub { color: var(--muted); font-size: 14px; margin: 4px 0 24px; }
.who { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 18px; }
.who button { padding: 16px 0 12px; border-radius: 20px; border: 2px solid transparent; background: #fff; display: grid; justify-items: center; gap: 6px; transition: all .3s var(--ease); font-size: 15px; }
.who button.on { border-color: var(--pink); transform: translateY(-3px); box-shadow: var(--shadow-sm); }
.who .avatar { --s: 60px; }
.login form > * + * { margin-top: 12px; }
.err { color: #d4577a; font-size: 14px; min-height: 1.4em; }

/* ---------- 动画 ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } }
@keyframes slide { from { transform: translateY(40px); opacity: 0; } }
@keyframes beat { 0%, 100% { transform: scale(1); } 12% { transform: scale(1.25); } 24% { transform: scale(1); } 36% { transform: scale(1.15); } }
@keyframes toast { 0% { opacity: 0; transform: translate(-50%, -10px); } 10%, 85% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; } }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.5); } 100% { transform: scale(1); } }
@keyframes floatup { to { transform: translate(var(--dx), -70px) scale(.6); opacity: 0; } }
.pop { animation: pop .4s var(--ease); }
.float-heart { position: absolute; pointer-events: none; color: var(--pink); font-size: 14px; animation: floatup .9s ease-out forwards; }
@media (prefers-reduced-motion: reduce) { * { animation-duration: .01ms !important; } }
