:root {
  color-scheme: light;
  --bg: #fff7fb;
  --panel: rgba(255, 255, 255, 0.8);
  --text: #5f4258;
  --muted: #8f6f84;
  --accent: #ff8fb3;
  --accent-2: #ffb7d2;
  --border: rgba(255, 143, 179, 0.24);
  --shadow: 0 16px 36px rgba(245, 153, 196, 0.16);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(255, 190, 218, 0.35), transparent 24%),
    radial-gradient(circle at right center, rgba(255, 218, 236, 0.5), transparent 26%),
    linear-gradient(135deg, #fff7fb 0%, #ffeef6 50%, #fff6fb 100%);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

img {
  max-width: 100%;
  display: block;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.9rem 1rem;
  backdrop-filter: blur(18px);
  background: rgba(255, 247, 251, 0.9);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 8px 24px rgba(229, 170, 200, 0.12);
}

.brand {
  font-size: 1rem;
  font-weight: 700;
  text-decoration: none;
  color: var(--text);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.header-actions {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-wrap: wrap;
}

.nav-links {
  display: flex;
  gap: 0.9rem;
  align-items: center;
  flex-wrap: wrap;
}

.nav-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.95rem;
}

.nav-links a:hover,
#nav-custom a:hover {
  color: var(--accent);
}

#nav-custom a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.95rem;
}

.search-bar {
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 247, 251, 0.7);
  backdrop-filter: blur(12px);
}

.search-inner {
  width: min(1100px, 100%);
  margin: 0 auto;
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.search-input {
  flex: 1;
  min-width: 160px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.5rem 1rem;
  font: inherit;
  font-size: 0.9rem;
  color: var(--text);
  background: rgba(255, 255, 255, 0.85);
  transition: border-color 0.15s;
}

.search-input:focus {
  outline: none;
  border-color: var(--accent);
}

.search-date {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.5rem 0.8rem;
  font: inherit;
  font-size: 0.9rem;
  color: var(--text);
  background: rgba(255, 255, 255, 0.85);
}

.search-date:focus {
  outline: none;
  border-color: var(--accent);
}

/* 加载中隐藏文字闪烁 */
body.loading [data-edit-key], body.loading .about-text, body.loading .about-content h3, body.loading footer p, body.loading .hero-text {
  visibility: hidden;
}
body.loading .eyebrow { visibility: hidden; }

main {
  width: min(1100px, calc(100% - 1.2rem));
  margin: 0 auto;
  padding: 1rem 0 3.5rem;
}

.hero {
  display: grid;
  grid-template-columns: 1.25fr 0.75fr;
  gap: 1rem;
  align-items: center;
  padding: 1.2rem 0 1.8rem;
}

.hero-copy h1 {
  font-size: clamp(1.8rem, 4.5vw, 2.8rem);
  line-height: 1.1;
  margin: 0.2rem 0 0.8rem;
}

.hero-text {
  color: var(--muted);
  max-width: 650px;
  font-size: 0.98rem;
}

.eyebrow {
  display: inline-block;
  margin: 0 0 0.35rem;
  color: var(--accent);
  font-size: 0.84rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.hero-actions {
  display: flex;
  gap: 0.7rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.btn,
.mini-btn {
  border: 0;
  cursor: pointer;
  display: inline-block;
  padding: 0.75rem 1rem;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 600;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  color: var(--text);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 10px 20px rgba(232, 161, 194, 0.16);
}

.btn:hover,
.sort-btn {
  margin-left: 0.5rem;
  font-size: 0.78rem;
  padding: 0.3rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255,255,255,0.7);
  color: var(--accent);
  cursor: pointer;
  white-space: nowrap;
}
.sort-btn:hover { background: rgba(255,143,179,0.15); }

.mini-btn:hover {
  transform: translateY(-2px);
}

.btn.primary,
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
}

.btn.secondary,
.btn-secondary {
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid var(--border);
}

.btn.small {
  padding: 0.58rem 0.85rem;
  font-size: 0.9rem;
}

.hero-card,
.card,
.timeline-item,
.record-card,
.record-form {
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.hero-card {
  padding: 1.1rem;
  min-height: 240px;
  display: flex;
  align-items: end;
  background: linear-gradient(135deg, rgba(255, 143, 179, 0.2), rgba(255, 201, 227, 0.25));
}

.hero-card-inner {
  padding: 0.95rem;
  border-radius: 18px;
  background: rgba(255, 247, 251, 0.9);
  width: 100%;
}

.status,
.status-pill {
  color: var(--accent);
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.section {
  padding: 1.2rem 0;
}

.about-section {
  margin: 0.4rem 0 1.2rem;
}

.about-card {
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  padding: 1rem 1.1rem;
}

.about-card {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.avatar-shell {
  width: 72px;
  height: 72px;
  border-radius: 24px;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 1.15rem;
  color: white;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 12px 24px rgba(255, 143, 179, 0.25);
}

.about-content h3 {
  margin: 0 0 0.35rem;
}

.about-text {
  margin: 0;
  color: var(--muted);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  margin-bottom: 0.8rem;
  gap: 0.8rem;
}

.section-header h2 {
  margin: 0;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.card {
  padding: 1rem 1.05rem;
}

.card h3 {
  margin-top: 0;
  margin-bottom: 0.4rem;
}

.card p {
  margin: 0;
  color: var(--muted);
}

.post-label {
  display: inline-block;
  margin-bottom: 0.6rem;
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  font-size: 0.78rem;
  background: rgba(255, 143, 179, 0.15);
  color: var(--accent);
}

.post-meta {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 0.35rem;
}

.timeline {
  display: grid;
  gap: 1rem;
}

.timeline-item {
  padding: 1rem 1.05rem;
}

.timeline-date {
  color: var(--accent);
  font-size: 0.82rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.record-form {
  display: none;
  flex-direction: column;
  gap: 0.7rem;
  padding: 0.9rem;
  margin-bottom: 0.8rem;
}

.record-form.active {
  display: flex;
}

.record-input,
.record-textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.7rem 0.8rem;
  font: inherit;
  color: var(--text);
  background: rgba(255, 255, 255, 0.82);
}

.record-textarea {
  min-height: 90px;
  resize: vertical;
}

.record-list {
  display: grid;
  gap: 0.9rem;
}

.record-card {
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.record-card img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  border-radius: 16px;
}

.record-placeholder {
  width: 100%;
  height: 220px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(255, 143, 179, 0.16), rgba(255, 218, 235, 0.24));
  color: var(--muted);
}

.record-meta {
  color: var(--muted);
  font-size: 0.85rem;
}

.footer {
  padding: 2rem 1rem 3rem;
  text-align: center;
  color: var(--muted);
}

.edit-mode [contenteditable="true"] {
  outline: 1px dashed rgba(255, 143, 179, 0.45);
  border-radius: 10px;
  padding: 0.2rem 0.35rem;
  background: rgba(255, 255, 255, 0.45);
}

/* ===== 卡片可点击 & 悬浮 ===== */
.card,
.timeline-item,
.record-card,
.about-card {
  position: relative;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* 卡片内图片不拦截点击 */
.card-thumb,
.card img,
.timeline-item img,
.record-card img {
  pointer-events: none;
}

.card:hover,
.timeline-item:hover,
.record-card:hover,
.about-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 20px 40px rgba(245, 153, 196, 0.22);
}

/* 卡片内缩略图 */
.card-thumb {
  width: 100%;
  height: 140px;
  object-fit: cover;
  border-radius: 14px;
  margin-bottom: 0.6rem;
}

/* 卡片内链接标记 */
.card-link-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--accent);
  font-size: 0.8rem;
  margin-top: 0.35rem;
}

/* ===== 模态框 ===== */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal.active {
  display: flex;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(90, 60, 80, 0.35);
  z-index: 0;
}

.modal-container {
  position: relative;
  z-index: 1;
  width: min(600px, calc(100vw - 2rem));
  max-height: 85vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: 0 24px 56px rgba(180, 120, 150, 0.3);
  padding: 1.5rem 1.6rem;
  animation: modalIn 0.25s ease;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.1rem;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.25rem;
}

.modal-close-btn {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 143, 179, 0.12);
  color: var(--text);
  font-size: 1.3rem;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.15s;
}

.modal-close-btn:hover {
  background: rgba(255, 143, 179, 0.25);
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.modal-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.modal-field label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.modal-field input,
.modal-field textarea,
.modal-field select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.65rem 0.8rem;
  font: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: rgba(255, 255, 255, 0.82);
  transition: border-color 0.15s;
}

.modal-field input:focus,
.modal-field textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.modal-field textarea {
  min-height: 90px;
  resize: vertical;
}

.modal-field .field-value {
  padding: 0.5rem 0;
  color: var(--text);
  line-height: 1.7;
}

.modal-field .field-value a {
  color: var(--accent);
  word-break: break-all;
}

.modal-image-preview {
  width: 100%;
  max-height: 320px;
  object-fit: cover;
  border-radius: 16px;
  margin-top: 0.3rem;
}

.modal-image-placeholder {
  width: 100%;
  height: 140px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(255, 143, 179, 0.1), rgba(255, 218, 235, 0.18));
  color: var(--muted);
  font-size: 0.9rem;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.8rem;
  margin-top: 1.3rem;
  padding: 1rem 0 0.5rem;
  border-top: 1px solid var(--border);
  position: sticky;
  bottom: 0;
  background: var(--panel);
  z-index: 2;
}

.modal-footer .btn {
  min-height: 44px;
  min-width: 80px;
  font-size: 1rem;
  touch-action: manipulation;
}

.modal-footer.hidden {
  display: none;
}
  .hero,
  .about-section {
    grid-template-columns: 1fr;
  }

  .card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .topbar,
  .section-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .header-actions,
  .hero-actions {
    width: 100%;
  }

  .nav-links {
    width: 100%;
    justify-content: space-between;
  }

  .card-grid {
    grid-template-columns: 1fr;
  }

  .about-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .record-card img,
  .record-placeholder {
    height: 180px;
  }
}

/* "查看更多" 链接 */
.more-link {
  display: block;
  text-align: center;
  padding: 0.8rem;
  margin-top: 0.4rem;
  border: 1px dashed var(--border);
  border-radius: 16px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  transition: background 0.15s;
}
.more-link:hover { background: rgba(255,143,179,0.08); }

/* 卡片图片计数 */
.img-count {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: rgba(0,0,0,0.55);
  color: #fff;
  font-size: 0.72rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  z-index: 2;
}

/* ===== 图片轮播 ===== */
.carousel {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  margin-bottom: 0.3rem;
}

.carousel-track {
  display: flex;
  transition: transform 0.3s ease;
}

.carousel-slide {
  min-width: 100%;
  max-height: 400px;
  object-fit: contain;
  background: rgba(0,0,0,0.03);
  cursor: zoom-in;
}

.carousel-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  padding: 0.5rem 0;
}

.carousel-btn {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  cursor: pointer;
  font-size: 1rem;
  display: grid;
  place-items: center;
  color: var(--text);
}

.carousel-btn:hover {
  background: var(--accent);
  color: #fff;
}

.carousel-dots {
  display: flex;
  gap: 0.4rem;
}

.carousel-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  cursor: pointer;
  transition: background 0.2s;
}

.carousel-dot.active {
  background: var(--accent);
}

.carousel-counter {
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
  padding-bottom: 0.3rem;
}

/* 编辑模式 — 已有图片缩略图 */
.modal-existing-imgs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.3rem;
}

.existing-img-wrap {
  position: relative;
  width: 80px;
  height: 80px;
  border-radius: 10px;
  overflow: hidden;
}

.existing-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.remove-img-btn {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255,60,60,0.85);
  color: #fff;
  border: 0;
  font-size: 0.85rem;
  cursor: pointer;
  display: grid;
  place-items: center;
  line-height: 1;
}

/* ===== 图片灯箱 ===== */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2000;
  align-items: center;
  justify-content: center;
}

.lightbox.active {
  display: flex;
}

.lightbox-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  cursor: pointer;
}

.lightbox img {
  position: relative;
  max-width: 90vw;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 12px;
  z-index: 1;
}

.lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1.5rem;
  z-index: 2;
  background: rgba(255, 255, 255, 0.15);
  border: 0;
  color: #fff;
  font-size: 2rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

.lightbox-actions {
  position: absolute;
  bottom: 1.5rem;
  z-index: 2;
  display: flex;
  gap: 0.5rem;
}

.lightbox-actions .btn {
  font-size: 0.85rem;
  padding: 0.5rem 1rem;
  color: #fff;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.lightbox-actions .btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  background: rgba(255, 255, 255, 0.12);
  border: 0;
  color: #fff;
  font-size: 1.6rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.lightbox-nav:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* 模态框图片可点击 */
.modal-image-preview {
  cursor: zoom-in;
  transition: opacity 0.15s;
}

.modal-image-preview:hover {
  opacity: 0.85;
}

/* ===== 自定义区块 ===== */
.cs-actions {
  text-align: center;
  padding: 1rem 0 2rem;
}

.cs-header-btns {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

.cs-rename-btn, .cs-del-btn, .cs-add-btn {
  font-size: 0.78rem;
  padding: 0.35rem 0.6rem;
}

.cs-name-text {
  cursor: default;
}

/* ✏️ 编辑图标按钮 */
.section-header-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: 1px dashed rgba(255, 143, 179, 0.4);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  font-size: 0.75rem;
  margin-left: 0.3rem;
  vertical-align: middle;
  transition: background 0.15s;
}

.section-header-btn:hover {
  background: rgba(255, 143, 179, 0.2);
}
