* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ========== 卡密入口 ========== */
#gate {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, #1a0a2e 0%, #16213e 50%, #0f3460 100%);
  padding: 1rem;
}
.gate-inner {
  width: 100%;
  max-width: 400px;
  text-align: center;
}
.gate-inner h1 { margin: 0 0 0.5rem; font-size: 1.75rem; font-weight: 600; color: #fff; letter-spacing: 0.05em; }
.gate-desc { color: rgba(255,255,255,0.75); font-size: 0.95rem; margin-bottom: 1.5rem; }
#card-form { display: flex; flex-direction: column; gap: 0.75rem; }
#card-form input {
  padding: 0.9rem 1rem;
  border: 2px solid rgba(255,255,255,0.2);
  border-radius: 12px;
  background: rgba(255,255,255,0.08);
  color: #fff;
  font-size: 1rem;
  text-align: center;
  letter-spacing: 0.1em;
}
#card-form input::placeholder { color: rgba(255,255,255,0.45); }
#card-form input:focus { outline: none; border-color: rgba(255,182,193,0.6); background: rgba(255,255,255,0.1); }
#card-form button {
  padding: 0.9rem;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #e91e63, #ff6090);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.05em;
}
#card-form button:hover { opacity: 0.95; transform: translateY(1px); }
.gate-error { color: #ff6b6b; font-size: 0.9rem; margin-top: 0.5rem; }
.gate-server-tip {
  margin-top: 1rem;
  padding: 0.75rem;
  background: rgba(255,200,100,0.2);
  border: 1px solid rgba(255,180,0,0.4);
  border-radius: 8px;
  color: #b38600;
  font-size: 0.85rem;
  line-height: 1.5;
}
.gate-buy-link {
  display: inline-block;
  margin-top: 1.25rem;
  padding: 0.5rem 1.25rem;
  border: 1px solid rgba(255,255,255,0.4);
  border-radius: 8px;
  color: rgba(255,255,255,0.95);
  font-size: 0.9rem;
  text-decoration: none;
  transition: background 0.2s, border-color 0.2s;
}
.gate-buy-link:hover {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.6);
  color: #fff;
}

/* ========== 专属页整体（原始 youyihs 背景） ========== */
#page {
  position: fixed;
  inset: 0;
  min-height: 100vh;
  color: #fff;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow-x: hidden;
  overflow-y: auto;
  z-index: 5;
  padding-top: 48px;
  padding-bottom: 48px;
  box-sizing: border-box;
}
#page .page-bg {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at top, #ff9a9e 0, #fecfef 35%, #f6d365 100%);
  z-index: 0;
}
#page .page-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 10% 20%, rgba(255,255,255,0.32), transparent 55%),
    radial-gradient(circle at 80% 0%, rgba(255,255,255,0.22), transparent 60%),
    radial-gradient(circle at 50% 100%, rgba(255,255,255,0.25), transparent 55%);
  mix-blend-mode: screen;
  pointer-events: none;
}
#page.has-bg-image .page-bg { background-size: cover; background-position: center; }

.page { width: 100%; max-width: 960px; padding: 0 16px 40px; margin: 0 auto; position: relative; z-index: 1; flex-shrink: 0; }
.card {
  background: radial-gradient(circle at top left, rgba(255,255,255,0.2), rgba(255,255,255,0.08));
  border-radius: 24px;
  box-shadow: 0 24px 60px rgba(150,60,100,0.45);
  border: 1px solid rgba(255,255,255,0.35);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 26px 22px 30px;
  position: relative;
  overflow: hidden;
}
@media (min-width: 768px) { .card { padding: 32px 40px 40px; } }

.hero { text-align: center; margin-bottom: 24px; position: relative; z-index: 1; }
.hero-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(0,0,0,0.08);
  border: 1px solid rgba(255,255,255,0.55);
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 10px;
}
.hero-tag span {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 8px;
  background: radial-gradient(circle at 30% 30%, #fff, #ff6ba4);
  box-shadow: 0 0 10px rgba(255,255,255,0.9);
}
.hero-recipient { font-size: 18px; margin-bottom: 8px; letter-spacing: 0.08em; }
.hero-title { font-size: 26px; font-weight: 700; letter-spacing: 0.16em; text-indent: 0.16em; margin-bottom: 12px; }
@media (min-width: 768px) { .hero-title { font-size: 30px; } }
.hero-subtitle { font-size: 14px; opacity: 0.9; }
.hero-subtitle span { padding: 0 6px; }

.start-area { margin-top: 22px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.start-tip { font-size: 13px; opacity: 0.8; }
.btn-primary {
  border: none;
  outline: none;
  cursor: pointer;
  padding: 10px 26px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ff6ba4, #ff8f70);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-indent: 0.18em;
  box-shadow: 0 12px 25px rgba(204,73,125,0.68);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(204,73,125,0.8);
  filter: brightness(1.05);
}
.btn-primary:active { transform: translateY(0); box-shadow: 0 8px 18px rgba(204,73,125,0.65); }
.btn-primary-dot { width: 7px; height: 7px; border-radius: 50%; background: #fff; }
.btn-primary-arrow { font-size: 14px; }

.content-wrapper { display: grid; grid-template-columns: minmax(0, 1.2fr); gap: 18px; margin-top: 28px; align-items: stretch; }
.content-wrapper.hidden { opacity: 0; transform: translateY(16px); pointer-events: none; }
.content-wrapper.fade-in { animation: fade-in-up 0.7s ease forwards; }
@keyframes fade-in-up {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (min-width: 900px) {
  .content-wrapper { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.1fr); gap: 24px; }
}

.message-block {
  padding: 18px;
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(0,0,0,0.25), rgba(255,255,255,0.08));
  border: 1px solid rgba(255,255,255,0.4);
  overflow: hidden;
}
@media (min-width: 768px) { .message-block { padding: 20px 22px; } }
.message-title {
  font-size: 15px;
  letter-spacing: 0.16em;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.message-title::before {
  content: "";
  width: 20px;
  height: 1px;
  border-radius: 999px;
  background: linear-gradient(to right, rgba(255,255,255,0.9), transparent);
}
.message-text { line-height: 1.9; font-size: 15px; opacity: 0.94; white-space: pre-line; }
.message-text p + p { margin-top: 4px; }
.message-sign { margin-top: 16px; font-size: 13px; opacity: 0.9; text-align: right; }
.message-sign span { display: block; }
.typewriter span {
  border-right: 0.12em solid rgba(255,255,255,0.7);
  animation: blink-caret 0.8s steps(2, start) infinite;
  padding-right: 2px;
}
@keyframes blink-caret {
  0%, 40% { border-color: rgba(255,255,255,0.8); }
  50%, 100% { border-color: transparent; }
}

.photos-block {
  padding: 14px;
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(255,255,255,0.09), rgba(255,255,255,0.02));
  border: 1px solid rgba(255,255,255,0.45);
  overflow: hidden;
}
@media (min-width: 768px) { .photos-block { padding: 16px 18px; } }
.photos-label {
  font-size: 13px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  opacity: 0.86;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.photos-label span { font-size: 11px; opacity: 0.8; }
.photos-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.photo-item {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  aspect-ratio: 3 / 4;
  box-shadow: 0 12px 32px rgba(118,64,95,0.55);
  transform-origin: center;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.photo-item:nth-child(1) { transform: translateY(4px) rotate(-4deg); }
.photo-item:nth-child(2) { transform: translateY(-4px); }
.photo-item:nth-child(3) { transform: translateY(4px) rotate(4deg); }
.photo-item img { width: 100%; height: 100%; object-fit: cover; display: block; filter: saturate(1.08) contrast(1.02); }
.photo-item::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.18), transparent 55%);
  opacity: 0.9;
}
.photo-item:hover { transform: translateY(-3px) scale(1.02); box-shadow: 0 18px 40px rgba(96,54,93,0.6); }
.photo-item.hide { display: none; }
.photo-caption { position: absolute; left: 10px; bottom: 10px; z-index: 2; font-size: 11px; opacity: 0.94; }
.photo-caption span { display: block; }

/* 专属链接区 */
.share-bar {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid rgba(255,255,255,0.25);
  width: 100%;
}
.share-label { margin: 0 0 0.5rem; font-size: 0.82rem; opacity: 0.9; }
.share-row { display: flex; gap: 0.5rem; margin-bottom: 0.75rem; }
.share-row input {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border: 1px solid rgba(255,255,255,0.4);
  border-radius: 10px;
  font-size: 0.85rem;
  background: rgba(255,255,255,0.15);
  color: #fff;
}
.share-row input::placeholder { color: rgba(255,255,255,0.6); }
.share-row button {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 10px;
  background: rgba(255,255,255,0.35);
  color: #fff;
  font-size: 0.88rem;
  cursor: pointer;
  white-space: nowrap;
}
.share-row button:hover { background: rgba(255,255,255,0.5); }
.share-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.btn-share {
  display: inline-block;
  padding: 0.5rem 1.2rem;
  border: none;
  border-radius: 10px;
  background: rgba(255,255,255,0.35);
  color: #fff;
  font-size: 0.88rem;
  cursor: pointer;
}
.btn-share:hover { background: rgba(255,255,255,0.5); }
.btn-edit {
  display: inline-block;
  padding: 0.5rem 1.2rem;
  border: 1px solid rgba(255,255,255,0.5);
  border-radius: 10px;
  background: transparent;
  color: #fff;
  font-size: 0.88rem;
  cursor: pointer;
}
.btn-edit:hover { background: rgba(255,255,255,0.2); }

.footer { margin-top: 22px; font-size: 12px; text-align: center; opacity: 0.9; }
.footer span { display: inline-block; margin: 0 2px; }
.footer-heart { color: #ffdeef; text-shadow: 0 0 6px rgba(255,255,255,0.8); }

/* 右下角音乐按钮（原始样式） */
.music-toggle {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #fff, #ffe1f0);
  box-shadow: 0 10px 25px rgba(118,53,96,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 50;
  border: 1px solid rgba(255,255,255,0.9);
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}
.music-toggle:hover { transform: translateY(-2px); box-shadow: 0 14px 30px rgba(118,53,96,0.8); filter: brightness(1.06); }
.music-toggle:active { transform: translateY(0); box-shadow: 0 8px 18px rgba(118,53,96,0.72); }
.music-toggle-icon { width: 22px; height: 22px; position: relative; }
.music-note {
  position: absolute;
  left: 6px;
  top: 5px;
  width: 11px;
  height: 12px;
  border-radius: 2px;
  border: 2px solid #ff6ba4;
  border-bottom-width: 3px;
  border-right-width: 3px;
  transform-origin: bottom left;
}
.music-note::after {
  content: "";
  position: absolute;
  left: 2px;
  bottom: -4px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #ff6ba4;
}
.music-note::before {
  content: "";
  position: absolute;
  right: -6px;
  bottom: -2px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #ff8f70;
}
.music-wave {
  position: absolute;
  right: 1px;
  top: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(255,107,164,0.9);
  border-left-color: transparent;
  border-bottom-color: transparent;
  transform: rotate(18deg);
}
.music-toggle.paused .music-wave { opacity: 0.3; }
.music-toggle.playing .music-wave { animation: music-wave 1.4s ease-in-out infinite; }
@keyframes music-wave {
  0%, 100% { transform: rotate(18deg) scale(1); opacity: 1; }
  50% { transform: rotate(18deg) scale(1.12); opacity: 0.3; }
}
.music-toggle-text {
  position: absolute;
  top: -24px;
  right: 0;
  background: rgba(0,0,0,0.45);
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 11px;
  white-space: nowrap;
  letter-spacing: 0.14em;
}
.music-toggle-hint {
  position: fixed;
  left: 16px;
  bottom: 18px;
  font-size: 12px;
  background: rgba(0,0,0,0.35);
  border-radius: 999px;
  padding: 6px 12px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.5);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.4s ease, transform 0.4s ease;
  pointer-events: none;
  z-index: 50;
}
.music-toggle-hint.visible { opacity: 1; transform: translateY(0); }
.music-toggle-hint span { opacity: 0.9; }

/* 漂浮爱心 */
.hearts-layer { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.heart {
  position: absolute;
  width: 12px;
  height: 12px;
  transform: rotate(-45deg);
  background: radial-gradient(circle at 30% 30%, #ffe9f4, #ff6ba4);
  opacity: 0;
  animation: float-heart 6s linear forwards;
}
.heart::before, .heart::after {
  content: "";
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: inherit;
}
.heart::before { top: -6px; left: 0; }
.heart::after { top: 0; left: 6px; }
@keyframes float-heart {
  0% { transform: translateY(0) scale(0.7) rotate(-45deg); opacity: 0; }
  10% { opacity: 1; }
  70% { opacity: 1; }
  100% { transform: translateY(-140px) scale(1.2) rotate(-45deg); opacity: 0; }
}

/* ========== 修改弹窗 ========== */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 1rem;
}
.modal-content {
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  overflow-y: auto;
  background: #fff;
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: 0 25px 60px rgba(0,0,0,0.25);
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.modal-header h3 { margin: 0; font-size: 1.15rem; color: #2d3436; }
.modal-header .close {
  background: none;
  border: none;
  color: #636e72;
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  padding: 0 0.25rem;
}
.modal-header .close:hover { color: #2d3436; }
.edit-hint { margin: 0 0 0.6rem; font-size: 0.9rem; color: #636e72; }
#edit-card-key {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid #ddd;
  border-radius: 10px;
  margin-bottom: 0.5rem;
  font-size: 1rem;
}
#edit-verify-btn {
  padding: 0.6rem 1.2rem;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #ff6ba4, #ff8f70);
  color: #fff;
  font-size: 0.9rem;
  cursor: pointer;
}
.edit-err { margin-top: 0.5rem; font-size: 0.85rem; color: #d63031; }
#edit-form .form-row { margin-bottom: 0.75rem; }
#edit-form .form-row label { display: block; margin-bottom: 0.25rem; font-size: 0.85rem; color: #555; }
#edit-form .form-row input, #edit-form .form-row textarea {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 0.9rem;
}
#edit-form .form-row-photo .photo-row-actions { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.25rem; flex-wrap: wrap; }
#edit-form .form-row-photo .photo-upload { margin: 0; }
#edit-form .form-row-photo .btn-photo-del {
  padding: 0.35rem 0.75rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: #fff;
  color: #666;
  font-size: 0.85rem;
  cursor: pointer;
}
#edit-form .form-row-photo .btn-photo-del:hover { background: #f5f5f5; color: #c00; border-color: #e0e0e0; }
#edit-form .form-row-photo .photo-preview {
  display: block;
  margin-top: 0.5rem;
  max-width: 120px;
  max-height: 120px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid #eee;
}
#edit-form .form-row-photo .photo-preview[src=""],
#edit-form .form-row-photo .photo-preview:not([src]) { display: none; }
#edit-form .form-actions { margin-top: 1rem; display: flex; gap: 0.5rem; justify-content: flex-end; }
#edit-form .btn-cancel { padding: 0.5rem 1rem; border: 1px solid #ccc; border-radius: 8px; background: #fff; cursor: pointer; }
#edit-form .btn-save { padding: 0.5rem 1rem; border: none; border-radius: 8px; background: linear-gradient(135deg, #ff6ba4, #ff8f70); color: #fff; cursor: pointer; }

@media (max-width: 520px) { .share-row { flex-direction: column; } }
