/* ==========================================================================
   生日祝福网站 —— 共用样式
   配色：奶油粉底 + 玫红点缀，柔和圆角与轻投影
   ========================================================================== */

*,
*::before,
*::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg-1: #fffafc;
  --bg-2: #fdeef4;
  --bg-3: #fbe0ea;
  --rose: #f2679a;
  --rose-deep: #d94a7e;
  --rose-soft: #ffe3ee;
  --ink: #3f2a34;
  --ink-2: #6d5560;
  --ink-3: #9b8890;
  --card: #ffffff;
  --line: #f6e2ea;
  --shadow-sm: 0 2px 10px rgba(214, 140, 170, .10);
  --shadow-md: 0 8px 26px rgba(214, 140, 170, .14);
  --shadow-lg: 0 18px 42px rgba(205, 120, 155, .18);
  --radius: 18px;
}

html { scroll-behavior: smooth; }

body {
  min-height: 100dvh;
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
               "Noto Sans SC", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, var(--bg-1) 0%, var(--bg-2) 45%, var(--bg-3) 100%);
  background-attachment: fixed;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

/* ---------- 背景飘浮爱心 ---------- */

.hearts {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.hearts i {
  position: absolute;
  display: block;
  font-style: normal;
  line-height: 1;
  opacity: .30;
  user-select: none;
  animation: floatUp linear infinite;
}

@keyframes floatUp {
  0%   { transform: translateY(0) rotate(-8deg) scale(.9); opacity: 0; }
  12%  { opacity: .34; }
  85%  { opacity: .30; }
  100% { transform: translateY(-108vh) rotate(10deg) scale(1.08); opacity: 0; }
}

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

.nav {
  position: sticky;
  top: 0;
  z-index: 20;
  width: 100%;
  background: rgba(255, 255, 255, .82);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid rgba(246, 226, 234, .9);
}

/* 顶栏版心：宽度与 .wrap 对齐 */
.nav-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 14px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: .02em;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}

.brand .bi { color: var(--rose); font-size: 17px; line-height: 1; }

.nav-links { display: flex; align-items: center; gap: 6px; }

.nav-links a {
  display: inline-block;
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 14.5px;
  color: var(--ink-2);
  text-decoration: none;
  transition: background .18s ease, color .18s ease;
}

.nav-links a:hover { background: var(--rose-soft); color: var(--rose-deep); }

.nav-links a.active {
  background: var(--rose-soft);
  color: var(--rose-deep);
  font-weight: 600;
}

/* ---------- 页面容器 ---------- */

.wrap {
  position: relative;
  z-index: 1;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 22px 72px;
}

.wrap.narrow { max-width: 780px; }

/* ---------- 首页 Hero ---------- */

.hero {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 20px;
  padding: 68px 22px 26px;
  min-height: calc(100dvh - 210px);
  justify-content: center;
}

.hero-icon {
  width: 76px;
  height: 76px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, #ffe9f1, #ffd4e4);
  box-shadow: 0 10px 26px rgba(226, 128, 165, .22),
              inset 0 1px 0 rgba(255, 255, 255, .9);
  font-size: 32px;
  color: var(--rose);
  animation: beat 2.4s ease-in-out infinite;
}

@keyframes beat {
  0%, 100% { transform: scale(1); }
  14%      { transform: scale(1.09); }
  28%      { transform: scale(1); }
  42%      { transform: scale(1.06); }
  56%      { transform: scale(1); }
}

.hero h1 {
  font-size: clamp(38px, 8vw, 62px);
  font-weight: 800;
  letter-spacing: .06em;
  line-height: 1.15;
  color: #3a2530;
}

.hero .sub {
  font-size: clamp(16px, 3.2vw, 20px);
  color: var(--ink-2);
  letter-spacing: .04em;
}

.hero .sub-2 {
  font-size: clamp(13px, 2.6vw, 14.5px);
  color: var(--ink-3);
  letter-spacing: .1em;
}

/* ---------- 两张入口卡片 ---------- */

.cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  width: 100%;
  max-width: 600px;
  margin-top: 12px;
}

.card-link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, .9);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  text-decoration: none;
  color: inherit;
  transition: transform .2s ease, box-shadow .2s ease;
}

.card-link:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.card-link .ci {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--rose-soft);
  font-size: 20px;
}

.card-link .ct { font-size: 15.5px; font-weight: 700; color: var(--ink); }
.card-link .cd { font-size: 12.5px; color: var(--ink-3); letter-spacing: .03em; }

/* ---------- 通用页面标题 ---------- */

.page-head {
  text-align: center;
  padding: 46px 0 26px;
}

.page-head h2 {
  font-size: clamp(26px, 5vw, 36px);
  font-weight: 800;
  letter-spacing: .05em;
}

.page-head p {
  margin-top: 8px;
  font-size: 14px;
  color: var(--ink-3);
  letter-spacing: .06em;
}

/* ---------- 表单 ---------- */

.form-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 22px;
  margin-bottom: 26px;
}

.form-row { margin-bottom: 13px; }

.form-row:last-of-type { margin-bottom: 0; }

.form-card label {
  display: block;
  font-size: 13px;
  color: var(--ink-2);
  margin-bottom: 6px;
  letter-spacing: .04em;
}

input[type="text"],
textarea {
  width: 100%;
  font: inherit;
  font-size: 14.5px;
  color: var(--ink);
  background: #fffafc;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 14px;
  transition: border-color .18s ease, box-shadow .18s ease;
  resize: vertical;
}

input[type="text"]:focus,
textarea:focus {
  outline: none;
  border-color: var(--rose);
  box-shadow: 0 0 0 3px rgba(242, 103, 154, .13);
}

.form-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
}

.counter { font-size: 12px; color: var(--ink-3); }

.btn {
  font: inherit;
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: .05em;
  color: #fff;
  background: linear-gradient(135deg, #ff85ae, var(--rose) 55%, var(--rose-deep));
  border: none;
  border-radius: 999px;
  padding: 11px 30px;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(226, 110, 155, .32);
  transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease;
}

.btn:hover { box-shadow: 0 12px 26px rgba(226, 110, 155, .42); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; }

.toast {
  font-size: 13px;
  color: var(--rose-deep);
  letter-spacing: .04em;
  min-height: 20px;
}

.toast.err { color: #c0392b; }

/* ---------- 工具条 ---------- */

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}

.seg {
  display: inline-flex;
  background: #fff;
  border-radius: 999px;
  padding: 4px;
  box-shadow: var(--shadow-sm);
}

.seg button {
  font: inherit;
  font-size: 13.5px;
  color: var(--ink-2);
  background: transparent;
  border: none;
  border-radius: 999px;
  padding: 7px 18px;
  cursor: pointer;
  transition: background .18s ease, color .18s ease;
}

.seg button.on {
  background: var(--rose-soft);
  color: var(--rose-deep);
  font-weight: 600;
}

.count { font-size: 13px; color: var(--ink-3); letter-spacing: .04em; }

/* ---------- 祝福墙 ---------- */

.wall {
  columns: 3 260px;
  column-gap: 16px;
}

.wish {
  break-inside: avoid;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 18px 20px;
  margin-bottom: 16px;
  border: 1px solid rgba(255, 255, 255, .8);
  transition: transform .2s ease, box-shadow .2s ease;
}

.wish:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.wish .who {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 9px;
}

.avatar {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #ffd9e6, #ffc0d6);
  color: #a33a63;
  font-size: 13px;
  font-weight: 700;
}

.wish .nm { font-size: 14px; font-weight: 600; color: var(--ink); }
.wish .tm { font-size: 11.5px; color: var(--ink-3); margin-left: auto; }
.wish .tx {
  font-size: 14.5px;
  color: var(--ink-2);
  line-height: 1.75;
  word-break: break-word;
  white-space: pre-wrap;
}

.wish .foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-top: 12px;
}

.like {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: inherit;
  font-size: 12.5px;
  color: var(--ink-3);
  background: #fff6f9;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 13px;
  cursor: pointer;
  transition: all .18s ease;
}

.like:hover { border-color: var(--rose); color: var(--rose-deep); }
.like.on { background: var(--rose-soft); border-color: var(--rose-soft); color: var(--rose-deep); font-weight: 600; }

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

.msg-list { display: flex; flex-direction: column; gap: 12px; }

.msg {
  display: flex;
  gap: 14px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 16px 20px;
}

.msg .avatar { width: 38px; height: 38px; font-size: 15px; }

.msg .body { flex: 1; min-width: 0; }

.msg .top {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 5px;
}

.msg .nm { font-size: 14.5px; font-weight: 600; }
.msg .tm { font-size: 11.5px; color: var(--ink-3); margin-left: auto; white-space: nowrap; }
.msg .tx {
  font-size: 14.5px;
  color: var(--ink-2);
  line-height: 1.75;
  word-break: break-word;
  white-space: pre-wrap;
}

/* ---------- 空状态 ---------- */

.empty {
  text-align: center;
  padding: 54px 20px;
  color: var(--ink-3);
  font-size: 14px;
  letter-spacing: .06em;
}

.empty .big { font-size: 34px; display: block; margin-bottom: 10px; opacity: .6; }

/* ---------- 页脚 ---------- */

.foot {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 30px 20px 40px;
  font-size: 12px;
  color: var(--ink-3);
  letter-spacing: .14em;
}

/* ---------- 音乐按钮 ---------- */

.music {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 30;
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  color: #fff;
  font-size: 19px;
  background: linear-gradient(135deg, #ff8db4, var(--rose) 60%, var(--rose-deep));
  box-shadow: 0 10px 24px rgba(226, 110, 155, .40);
  transition: transform .2s ease, box-shadow .2s ease;
}

.music:hover { transform: scale(1.07); box-shadow: 0 14px 30px rgba(226, 110, 155, .5); }
.music:active { transform: scale(.95); }
.music.playing { animation: spinPulse 2.6s linear infinite; }

@keyframes spinPulse {
  0%   { box-shadow: 0 10px 24px rgba(226, 110, 155, .40), 0 0 0 0 rgba(242, 103, 154, .45); }
  70%  { box-shadow: 0 10px 24px rgba(226, 110, 155, .40), 0 0 0 16px rgba(242, 103, 154, 0); }
  100% { box-shadow: 0 10px 24px rgba(226, 110, 155, .40), 0 0 0 0 rgba(242, 103, 154, 0); }
}

/* ---------- 撒花画布 ---------- */

#fx {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 25;
}

/* ---------- 响应式 ---------- */

@media (max-width: 620px) {
  .nav-inner { padding: 12px 16px; }
  .nav-links a { padding: 6px 11px; font-size: 13.5px; }
  .brand { font-size: 15px; }
  .wrap { padding: 0 16px 60px; }
  .hero { padding: 46px 16px 20px; }
  .cards { grid-template-columns: 1fr; max-width: 360px; }
  .wall { columns: 1; }
  .form-card { padding: 18px; }
  .msg { padding: 14px 16px; gap: 11px; }
  .music { right: 16px; bottom: 16px; width: 46px; height: 46px; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  html { scroll-behavior: auto; }
}

/* ---------- 移动端增强（2026-10-30 追加） ---------- */

/* 平板：621–1024 双列，不再硬走桌面布局 */
@media (min-width: 621px) and (max-width: 1024px) {
  .wrap { padding: 0 24px 66px; }
  .hero { padding: 64px 24px 24px; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wall { columns: 2; }
  .form-card { padding: 22px; }
}

/* 手机：铺满、防 iOS 聚焦放大、安全区 */
@media (max-width: 620px) {
  .cards { max-width: none; }
  .nav-links a { padding: 8px 12px; }
  .hero h1 { font-size: clamp(34px, 9.5vw, 46px); }
  input[type="text"], textarea { font-size: 16px; }
  .foot { padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px)); }
  .music { bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
}

/* 触控设备：补按压反馈（移动端没有 hover） */
@media (hover: none) and (pointer: coarse) {
  .nav-links a:active,
  .card-link:active,
  .seg button:active,
  .like:active { transform: scale(.97); opacity: .92; }
  a, button, .card-link, .like, .seg button { -webkit-tap-highlight-color: rgba(226, 110, 155, .18); }
}

/* 刘海/Home 条安全区 */
body { padding-bottom: env(safe-area-inset-bottom, 0px); }
