/* ==========================================================
   致一冉 · 温柔粉色主题样式（移动端优先）
   ========================================================== */
:root {
  --pink-50: #fff5f8;
  --pink-100: #ffe9f1;
  --pink-200: #ffd3e2;
  --pink-300: #ffb3cd;
  --pink-400: #ff8bb0;
  --pink-500: #ff6b9d;
  --pink-600: #f24b86;
  --pink-700: #d63b72;
  --text: #6b3f52;
  --text-light: #a07689;
  --card: rgba(255, 255, 255, 0.9);
  --shadow: 0 10px 30px rgba(242, 75, 134, 0.14);
  --radius: 18px;
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  background: linear-gradient(180deg, #fff5f8 0%, #ffe9f1 55%, #ffdce9 100%);
  background-attachment: fixed;
  line-height: 1.6;
  overflow-x: hidden;
}

/* ---------- 背景图层 ---------- */
.bg-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}
.bg-layer img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.38;
}

/* ---------- 爱心飘落画布 ---------- */
#heartCanvas {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

/* ---------- 内容容器 ---------- */
.page {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  padding: 0 16px 30px;
}

/* ---------- 通用卡片 ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 18px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.section {
  margin-top: 30px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin: 0 0 16px;
  font-size: 17px;
  font-weight: 700;
  color: var(--pink-600);
  letter-spacing: 0.5px;
}
.section-title .icon {
  width: 20px;
  height: 20px;
}

.icon {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- Hero 顶部 ---------- */
.hero {
  text-align: center;
  padding: 52px 10px 8px;
}
.hero-heart {
  width: 38px;
  height: 38px;
  fill: var(--pink-500);
  animation: heartbeat 1.6s ease-in-out infinite;
}
.hero h1 {
  margin: 16px 0 12px;
  font-size: 29px;
  font-weight: 800;
  color: var(--pink-700);
  letter-spacing: 1.5px;
}
.hero-sub {
  margin: 0 auto;
  max-width: 30em;
  font-size: 14.5px;
  color: var(--text-light);
  line-height: 1.85;
}
.hero-badge {
  display: inline-block;
  margin-top: 18px;
  padding: 6px 16px;
  font-size: 12px;
  letter-spacing: 1.2px;
  color: var(--pink-600);
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid var(--pink-200);
  border-radius: 999px;
}

@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  15% { transform: scale(1.18); }
  30% { transform: scale(1); }
  45% { transform: scale(1.12); }
  60% { transform: scale(1); }
}

/* ---------- 倒计时 ---------- */
.count-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
.count-card {
  text-align: center;
}
.count-name {
  margin: 0 0 16px;
  font-size: 15px;
  font-weight: 700;
}
.num-row {
  display: flex;
  justify-content: center;
  gap: 8px;
}
.num-box {
  flex: 1;
  max-width: 74px;
  padding: 10px 4px 8px;
  border-radius: 14px;
  background: linear-gradient(145deg, var(--pink-400), var(--pink-500));
  box-shadow: 0 6px 14px rgba(242, 75, 134, 0.25);
}
.num-box span {
  display: block;
  font-size: 24px;
  font-weight: 800;
  color: #fff;
  font-variant-numeric: tabular-nums;
}
.num-box label {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.88);
}
.count-foot {
  margin: 14px 0 0;
  font-size: 12.5px;
  color: var(--text-light);
}
.placeholder-box {
  margin: 4px 0 10px;
  padding: 18px 14px;
  border-radius: 14px;
  background: var(--pink-100);
  font-size: 13.5px;
  color: var(--text-light);
}

/* ---------- 信息卡片 ---------- */
.profile-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
.profile-card {
  padding: 16px 18px;
}
.card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 700;
  color: var(--pink-600);
}
.card-head .icon {
  width: 19px;
  height: 19px;
}
.card-body {
  margin: 10px 0 0;
  font-size: 14.5px;
  line-height: 1.75;
  color: var(--text);
  word-break: break-word;
}
.card-body:empty::after {
  content: attr(data-empty);
  color: var(--text-light);
  font-size: 13.5px;
}

/* ---------- 相册 ---------- */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.gallery-grid img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 14px;
  box-shadow: 0 6px 16px rgba(242, 75, 134, 0.16);
  animation: fadeIn 0.6s ease both;
}
.empty-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 34px 20px;
  color: var(--text-light);
  font-size: 14px;
  border: 1.5px dashed var(--pink-300);
  background: rgba(255, 255, 255, 0.6);
  box-shadow: none;
}
.empty-card .icon {
  width: 32px;
  height: 32px;
  color: var(--pink-400);
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- 留言板 ---------- */
.msg-card {
  padding: 18px;
}
.msg-tip {
  margin: 0 0 14px;
  font-size: 14.5px;
  font-weight: 700;
  color: var(--pink-700);
  line-height: 1.7;
}
textarea {
  width: 100%;
  display: block;
  padding: 12px 14px;
  border: 1.5px solid var(--pink-200);
  border-radius: 14px;
  background: #fffafc;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  resize: none;
  outline: none;
  transition: border-color 0.2s;
}
textarea:focus {
  border-color: var(--pink-400);
}
.msg-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
}
.word-count {
  font-size: 12.5px;
  color: var(--text-light);
}

.btn-primary {
  border: none;
  padding: 11px 24px;
  border-radius: 999px;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--pink-400), var(--pink-600));
  box-shadow: 0 8px 18px rgba(242, 75, 134, 0.3);
  cursor: pointer;
  transition: transform 0.15s;
}
.btn-primary:active {
  transform: scale(0.95);
}
.btn-ghost {
  border: 1.5px solid var(--pink-300);
  padding: 10px 22px;
  border-radius: 999px;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 700;
  color: var(--pink-600);
  background: #fff;
  cursor: pointer;
  transition: transform 0.15s;
}
.btn-ghost:active {
  transform: scale(0.95);
}

.msg-list {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.msg-item {
  position: relative;
  padding: 14px 16px 12px 18px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 6px 18px rgba(242, 75, 134, 0.1);
}
.msg-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 14px;
  bottom: 14px;
  width: 3.5px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--pink-400), var(--pink-600));
}
.msg-time {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  color: var(--text-light);
}
.msg-content {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.75;
  word-break: break-word;
  white-space: pre-wrap;
}

/* ---------- BGM 按钮 ---------- */
.bgm-btn {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 5;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--pink-400), var(--pink-600));
  box-shadow: 0 8px 20px rgba(242, 75, 134, 0.35);
  cursor: pointer;
}
.bgm-btn .icon {
  width: 23px;
  height: 23px;
  stroke: #fff;
}
.bgm-btn .icon-pause { display: none; }
.bgm-btn.playing .icon-note { display: none; }
.bgm-btn.playing .icon-pause { display: block; }
.bgm-btn.playing {
  animation: bgmGlow 2s ease-in-out infinite;
}
@keyframes bgmGlow {
  0%, 100% { box-shadow: 0 8px 20px rgba(242, 75, 134, 0.35); }
  50% { box-shadow: 0 8px 26px rgba(242, 75, 134, 0.6); }
}

/* ---------- 身份验证弹窗 ---------- */
.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(90, 40, 60, 0.45);
}
.modal-mask[hidden] { display: none; }
.modal {
  width: 100%;
  max-width: 380px;
  padding: 24px 22px;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 20px 50px rgba(120, 40, 80, 0.28);
  animation: popIn 0.22s ease;
}
@keyframes popIn {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}
.modal h3 {
  margin: 0 0 6px;
  font-size: 19px;
  color: var(--pink-700);
  text-align: center;
}
.modal-tip {
  margin: 0 0 18px;
  font-size: 13px;
  color: var(--text-light);
  text-align: center;
}
.field-label {
  display: block;
  margin: 12px 0 6px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--pink-600);
}
.field-input {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--pink-200);
  border-radius: 12px;
  background: #fffafc;
  font-family: var(--font);
  font-size: 16px;
  color: var(--text);
  outline: none;
}
.field-input:focus {
  border-color: var(--pink-400);
}
.auth-error {
  margin: 10px 0 0;
  font-size: 13px;
  color: #e0336e;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  top: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  max-width: 86%;
  padding: 11px 22px;
  border-radius: 999px;
  background: rgba(107, 63, 82, 0.92);
  color: #fff;
  font-size: 14px;
  text-align: center;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.2);
  animation: fadeIn 0.25s ease;
}

/* ---------- 页脚 ---------- */
.footer {
  margin-top: 36px;
  text-align: center;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.footer p {
  margin: 4px 0;
  font-size: 13px;
  color: var(--text);
}
.footer .footer-sub {
  font-size: 12px;
  color: var(--text-light);
}

/* ==========================================================
   桌面端适配
   ========================================================== */
@media (min-width: 768px) {
  .page { max-width: 720px; }
  .hero { padding-top: 64px; }
  .hero h1 { font-size: 34px; }
  .count-grid { grid-template-columns: repeat(2, 1fr); }
  .profile-grid { grid-template-columns: repeat(2, 1fr); }
  .gallery-grid { grid-template-columns: repeat(3, 1fr); gap: 14px; }
  .bgm-btn { top: 24px; right: 26px; }
}

/* ==========================================================
   减少动态偏好（无障碍）
   ========================================================== */
@media (prefers-reduced-motion: reduce) {
  .hero-heart,
  .bgm-btn.playing {
    animation: none;
  }
}
