* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: clip;
  color: #46343b;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.6;
  background:
    radial-gradient(circle at top left, rgba(255, 218, 226, 0.72), transparent 34rem),
    linear-gradient(135deg, #fffaf5 0%, #fff2f6 48%, #f5efff 100%);
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea,
select {
  font: inherit;
}

.container {
  width: min(100% - 32px, 1100px);
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 250, 248, 0.82);
  border-bottom: 1px solid rgba(239, 172, 190, 0.28);
  backdrop-filter: blur(16px);
}

.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 0;
  min-width: 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #794454;
  font-weight: 800;
  white-space: nowrap;
}

.brand img {
  width: 34px;
  height: 34px;
  border-radius: 12px;
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
}

.nav-links a {
  padding: 8px 12px;
  border-radius: 999px;
  color: #765c66;
  font-size: 14px;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.nav-links a:hover,
.nav-links a.active {
  color: #873d55;
  background: #ffe4ec;
  transform: translateY(-1px);
}

.nav-links a.mailbox-nav-link {
  position: relative;
  padding-right: 14px;
}

.nav-badge {
  position: absolute;
  top: -5px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: linear-gradient(135deg, #e07098, #c94d78);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  box-shadow: 0 6px 14px rgba(216, 91, 134, 0.28);
  pointer-events: none;
  z-index: 2;
}

.nav-badge.hidden {
  display: none;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr);
  align-items: center;
  gap: 36px;
  min-height: 520px;
  padding: 54px 0 36px;
}

.eyebrow,
.card-kicker {
  margin: 0 0 10px;
  color: #b46a81;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero h1,
.page-title h1 {
  margin: 0;
  color: #5c3140;
  font-size: clamp(34px, 6vw, 68px);
  line-height: 1.08;
  letter-spacing: 0;
}

.hero p {
  max-width: 620px;
  color: #765c66;
  font-size: 18px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 26px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 18px;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 800;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn.primary {
  color: #fff;
  background: linear-gradient(135deg, #e97996, #b98add);
  box-shadow: 0 14px 30px rgba(202, 103, 139, 0.28);
}

.btn.secondary {
  color: #794454;
  background: #fff;
  border: 1px solid rgba(224, 138, 162, 0.35);
  box-shadow: 0 10px 24px rgba(123, 73, 90, 0.08);
}

.btn.btn-secondary {
  color: #794454;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(224, 138, 162, 0.35);
  box-shadow: 0 10px 24px rgba(123, 73, 90, 0.08);
}

.btn.full {
  width: 100%;
}

.hero-tree {
  position: relative;
  height: 420px;
  overflow: hidden;
}

.mini-sun {
  position: absolute;
  top: 22px;
  right: 60px;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: #ffe9a6;
  box-shadow: 0 0 40px rgba(255, 218, 121, 0.6);
}

.mini-crown {
  position: absolute;
  left: 50%;
  top: 58px;
  width: 280px;
  height: 260px;
  transform: translateX(-50%);
  border-radius: 48% 52% 45% 55%;
  background: linear-gradient(135deg, #b8dfbd, #f8bfd0);
  box-shadow: 0 24px 70px rgba(130, 85, 104, 0.2);
}

.mini-crown span {
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff7be;
}

.mini-crown span:nth-child(1) { left: 24%; top: 30%; }
.mini-crown span:nth-child(2) { left: 48%; top: 18%; background: #f07e9b; }
.mini-crown span:nth-child(3) { left: 68%; top: 42%; background: #b98add; }
.mini-crown span:nth-child(4) { left: 36%; top: 58%; background: #7bbb8a; }
.mini-crown span:nth-child(5) { left: 58%; top: 66%; background: #ffb35f; }

.mini-trunk {
  position: absolute;
  left: 50%;
  bottom: 34px;
  width: 74px;
  height: 170px;
  transform: translateX(-50%);
  border-radius: 36px 36px 10px 10px;
  background: linear-gradient(90deg, #9a6a4d, #c88c66);
}

.grid {
  display: grid;
  gap: 18px;
}

.cards-grid,
.memory-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding-bottom: 48px;
}

.card {
  max-width: 100%;
  border: 1px solid rgba(238, 178, 194, 0.3);
  border-radius: 22px;
  padding: 22px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 18px 48px rgba(121, 68, 84, 0.09);
}

.card h2,
.card h3 {
  margin: 0 0 10px;
  color: #613644;
}

.card p {
  margin: 0;
  color: #765c66;
}

.highlight-card {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(255, 232, 239, 0.86));
}

.big-number {
  color: #d76080 !important;
  font-size: 38px;
  font-weight: 900;
}

.page-stack {
  padding: 42px 0 56px;
}

.page-stack > * + * {
  margin-top: 24px;
}

.page-title p {
  margin: 12px 0 0;
  color: #765c66;
}

.section-heading {
  color: #5c3140;
}

.form,
.form-grid {
  display: grid;
  gap: 14px;
}

.form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid .wide {
  grid-column: 1 / -1;
}

label {
  display: grid;
  gap: 7px;
  color: #674b55;
  font-weight: 700;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid rgba(199, 130, 150, 0.35);
  border-radius: 14px;
  padding: 11px 12px;
  color: #4c3940;
  background: rgba(255, 255, 255, 0.82);
  outline: none;
}

input:focus,
textarea:focus,
select:focus {
  border-color: #df7896;
  box-shadow: 0 0 0 4px rgba(223, 120, 150, 0.14);
}

textarea {
  resize: vertical;
}

.muted,
.form-tip {
  color: #8b727b;
  font-size: 14px;
}

.form-tip.show {
  color: #b55770;
}

.login-page {
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-shell {
  width: min(100%, 430px);
}

.login-card {
  padding: 34px;
  border: 1px solid rgba(238, 178, 194, 0.38);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 26px 70px rgba(121, 68, 84, 0.16);
}

.login-icon {
  width: 62px;
  height: 62px;
  margin: 0 auto 16px;
}

.login-card h1,
.login-subtitle {
  text-align: center;
}

.login-card h1 {
  margin: 0;
  color: #5c3140;
}

.login-subtitle {
  margin: 8px 0 24px;
  color: #8a6270;
}

.tree-stage {
  overflow: hidden;
}

.tree-3d-card,
.premium-tree-card {
  overflow: hidden;
  padding: 0;
}

.premium-tree-card {
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(255, 246, 250, 0.66));
  box-shadow:
    0 28px 80px rgba(116, 70, 88, 0.13),
    inset 0 1px 0 rgba(255, 255, 255, 0.88);
}

.planet-hero-card {
  overflow: hidden;
  padding: 0;
  border-radius: 28px;
  border-color: rgba(217, 188, 240, 0.34);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.74), rgba(248, 241, 255, 0.62));
  box-shadow:
    0 30px 90px rgba(68, 51, 94, 0.17),
    inset 0 1px 0 rgba(255, 255, 255, 0.86);
}

.tree-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 24px 24px 0;
}

.planet-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 24px 24px 0;
}

.tree-toolbar h2,
.tree-toolbar p,
.planet-toolbar h2,
.planet-toolbar p {
  margin: 0;
}

.tree-toolbar h2,
.planet-toolbar h2 {
  color: #5c3140;
}

.tree-toolbar p,
.planet-toolbar p {
  margin-top: 4px;
  color: #765c66;
}

.tree-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.planet-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.tree-3d-stage,
.premium-tree-stage {
  position: relative;
  height: 560px;
  margin: 18px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-radius: 22px;
  background:
    radial-gradient(circle at 28% 18%, rgba(255, 235, 190, 0.54), transparent 18rem),
    radial-gradient(circle at 72% 20%, rgba(234, 210, 255, 0.62), transparent 18rem),
    linear-gradient(180deg, rgba(255, 248, 252, 0.9), rgba(241, 250, 239, 0.76));
  box-shadow:
    inset 0 18px 80px rgba(255, 255, 255, 0.62),
    inset 0 -28px 80px rgba(181, 132, 151, 0.12);
}

.premium-tree-stage {
  height: 640px;
  margin: 20px;
  border-radius: 28px;
  background:
    radial-gradient(circle at 20% 16%, rgba(255, 232, 186, 0.46), transparent 17rem),
    radial-gradient(circle at 78% 18%, rgba(228, 210, 255, 0.62), transparent 18rem),
    radial-gradient(circle at 50% 86%, rgba(199, 232, 199, 0.58), transparent 20rem),
    linear-gradient(180deg, rgba(255, 249, 253, 0.94), rgba(247, 243, 255, 0.72) 52%, rgba(239, 250, 239, 0.82));
  box-shadow:
    inset 0 26px 120px rgba(255, 255, 255, 0.72),
    inset 0 -34px 100px rgba(139, 91, 110, 0.15),
    0 24px 70px rgba(106, 74, 91, 0.1);
}

.planet-stage {
  position: relative;
  width: 100%;
  max-width: 100%;
  height: 640px;
  margin: 20px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: 28px;
  background:
    radial-gradient(circle at 24% 18%, rgba(255, 201, 226, 0.34), transparent 16rem),
    radial-gradient(circle at 74% 20%, rgba(188, 197, 255, 0.34), transparent 18rem),
    radial-gradient(circle at 48% 84%, rgba(255, 229, 188, 0.18), transparent 17rem),
    linear-gradient(180deg, #171434 0%, #241a4a 46%, #5b4169 100%);
  box-shadow:
    inset 0 26px 120px rgba(255, 221, 239, 0.12),
    inset 0 -40px 120px rgba(8, 8, 31, 0.32),
    0 26px 80px rgba(54, 39, 85, 0.2);
}

#tree3DCanvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
}

#tree3DCanvas:active {
  cursor: grabbing;
}

#planetCanvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
}

#planetCanvas:active {
  cursor: grabbing;
}

.tree-3d-hint {
  position: absolute;
  right: 16px;
  bottom: 14px;
  padding: 7px 12px;
  border: 1px solid rgba(224, 138, 162, 0.24);
  border-radius: 999px;
  color: #805866;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 12px 30px rgba(86, 55, 67, 0.08);
  font-size: 13px;
  pointer-events: none;
}

.planet-hint {
  position: absolute;
  right: 16px;
  bottom: 14px;
  padding: 7px 12px;
  border: 1px solid rgba(255, 226, 238, 0.3);
  border-radius: 999px;
  color: #fff5fb;
  background: rgba(38, 28, 70, 0.46);
  box-shadow: 0 12px 30px rgba(20, 12, 36, 0.18);
  font-size: 13px;
  pointer-events: none;
  backdrop-filter: blur(10px);
}

.tree-loading {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 2;
  padding: 10px 16px;
  border: 1px solid rgba(224, 138, 162, 0.26);
  border-radius: 999px;
  color: #8b4d61;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 16px 42px rgba(86, 55, 67, 0.12);
  font-size: 14px;
  font-weight: 800;
  transform: translate(-50%, -50%);
  transition: opacity 0.22s ease, visibility 0.22s ease;
  pointer-events: none;
}

.planet-loading {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 2;
  padding: 10px 16px;
  border: 1px solid rgba(255, 226, 238, 0.34);
  border-radius: 999px;
  color: #fff6fb;
  background: rgba(39, 29, 73, 0.58);
  box-shadow: 0 16px 46px rgba(18, 11, 38, 0.24);
  font-size: 14px;
  font-weight: 800;
  transform: translate(-50%, -50%);
  transition: opacity 0.22s ease, visibility 0.22s ease;
  pointer-events: none;
  backdrop-filter: blur(12px);
}

.tree-loading.hidden,
.planet-loading.hidden {
  opacity: 0;
  visibility: hidden;
}

.tree-3d-stage.webgl-fallback,
.premium-tree-stage.webgl-fallback,
.planet-stage.webgl-fallback {
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
}

.tree-3d-stage.webgl-fallback p,
.premium-tree-stage.webgl-fallback p,
.planet-stage.webgl-fallback p {
  max-width: 420px;
  margin: 0;
  color: #fff5fb;
  font-weight: 800;
}

.photo-tree {
  position: relative;
  min-height: 560px;
  max-width: 760px;
  margin: 0 auto;
}

.tree-canopy {
  position: absolute;
  left: 50%;
  top: 24px;
  width: min(100%, 650px);
  height: 390px;
  transform: translateX(-50%);
  border-radius: 50% 47% 44% 56%;
  background:
    radial-gradient(circle at 28% 30%, #cdeccf 0 19%, transparent 20%),
    radial-gradient(circle at 58% 22%, #f9c3d2 0 22%, transparent 23%),
    radial-gradient(circle at 72% 48%, #d7c8f5 0 21%, transparent 22%),
    radial-gradient(circle at 42% 62%, #baddc0 0 25%, transparent 26%),
    linear-gradient(135deg, #b8dfbd, #f7c1d1 55%, #cfc3f4);
  box-shadow: inset 0 -20px 52px rgba(78, 102, 69, 0.1), 0 22px 60px rgba(121, 68, 84, 0.14);
}

.tree-trunk {
  position: absolute;
  left: 50%;
  bottom: 62px;
  width: 104px;
  height: 255px;
  transform: translateX(-50%);
  border-radius: 52px 52px 16px 16px;
  background: linear-gradient(90deg, #8c5f42, #c58b62 52%, #9b6746);
  box-shadow: inset -16px 0 0 rgba(93, 57, 38, 0.15);
}

.tree-ground {
  position: absolute;
  left: 50%;
  bottom: 34px;
  width: 86%;
  height: 58px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: rgba(185, 221, 190, 0.68);
}

.memory-node {
  position: absolute;
  z-index: 4;
  width: 30px;
  height: 30px;
  border: 3px solid rgba(255, 255, 255, 0.9);
  cursor: pointer;
  box-shadow: 0 9px 18px rgba(82, 52, 62, 0.2);
}

.memory-node:hover {
  transform: scale(1.14);
}

.memory-node.leaf {
  background: #63b77b;
  border-radius: 80% 10% 80% 10%;
}

.memory-node.flower {
  background: #f1779b;
  border-radius: 50%;
}

.memory-node.fruit {
  background: #ffad5c;
  border-radius: 50%;
}

.memory-node.star {
  background: #ffe277;
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 92%, 50% 70%, 21% 92%, 32% 57%, 2% 35%, 39% 35%);
}

.memory-card {
  position: relative;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.memory-gallery {
  align-items: stretch;
}

.memory-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 22px 52px rgba(121, 68, 84, 0.13);
}

.memory-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 16px;
  margin-bottom: 14px;
}

.tag {
  display: inline-flex;
  margin-bottom: 8px;
  padding: 4px 10px;
  border-radius: 999px;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

.tag.leaf { background: #63b77b; }
.tag.flower { background: #f1779b; }
.tag.fruit { background: #ff9a3d; }
.tag.star { background: #c39b17; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: none;
  place-items: center;
  padding: 20px;
  background: rgba(61, 38, 46, 0.42);
}

.modal.show {
  display: grid;
}

.modal-panel {
  position: relative;
  width: min(100%, 520px);
  border-radius: 24px;
  padding: 22px;
  border: 1px solid rgba(255, 226, 238, 0.6);
  background:
    linear-gradient(180deg, rgba(255, 252, 250, 0.98), rgba(255, 244, 249, 0.98));
  box-shadow: 0 34px 96px rgba(52, 31, 59, 0.36);
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  color: #794454;
  background: #ffe7ee;
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
}

.modal-body img {
  border-radius: 18px;
  margin-bottom: 16px;
}

.notes-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.sticky-note {
  min-height: 180px;
  padding: 22px;
  border-radius: 10px 24px 12px 24px;
  box-shadow: 0 16px 36px rgba(92, 60, 70, 0.12);
}

.sticky-note p {
  margin: 0 0 22px;
  color: #503b43;
  font-size: 17px;
}

.note-meta {
  display: grid;
  gap: 4px;
  color: #765c66;
  font-size: 13px;
}

.note-pink { background: #ffe3ec; }
.note-yellow { background: #fff3bd; }
.note-blue { background: #dff0ff; }
.note-purple { background: #eee3ff; }

.sticky-note .note-actions {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  max-width: calc(100% - 24px);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.btn.message-delete-btn {
  padding: 0.22rem 0.5rem;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.2;
  color: #fff;
  background: linear-gradient(135deg, #c9789a 0%, #9a6a9c 100%);
  border: 1px solid rgba(90, 50, 80, 0.2);
  border-radius: 999px;
  box-shadow: 0 1px 4px rgba(90, 50, 80, 0.12);
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease, box-shadow 0.15s ease;
  white-space: nowrap;
}

.btn.message-delete-btn:hover {
  filter: brightness(1.05);
  box-shadow: 0 2px 8px rgba(90, 50, 80, 0.18);
  transform: translateY(-1px);
}

.btn.message-delete-btn:active {
  transform: translateY(0);
}

.sticky-note .note-actions ~ .visibility-badge {
  margin-top: 42px;
}

.visibility-badge {
  display: inline-block;
  margin: 0 0 10px;
  padding: 0.28rem 0.65rem;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.35;
  border-radius: 999px;
  max-width: 100%;
  box-sizing: border-box;
  word-break: break-word;
}

.visibility-badge.private {
  color: #6b4a6f;
  background: rgba(232, 210, 245, 0.65);
  border: 1px solid rgba(150, 110, 170, 0.28);
}

.visibility-badge.public {
  color: #7a6570;
  background: rgba(255, 255, 255, 0.45);
  border: 1px solid rgba(180, 140, 155, 0.22);
}

.btn.message-publish-btn {
  padding: 0.22rem 0.5rem;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.2;
  color: #6e4d62;
  background: rgba(255, 248, 252, 0.92);
  border: 1px solid rgba(180, 130, 155, 0.35);
  border-radius: 999px;
  box-shadow: 0 1px 3px rgba(110, 70, 90, 0.08);
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
  white-space: nowrap;
}

.btn.message-publish-btn:hover {
  background: rgba(255, 236, 244, 0.98);
  box-shadow: 0 2px 8px rgba(110, 70, 90, 0.12);
  transform: translateY(-1px);
}

.btn.message-publish-btn:active {
  transform: translateY(0);
}

.timeline-list {
  position: relative;
  display: grid;
  gap: 22px;
  padding-left: 28px;
}

.timeline-list::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: linear-gradient(#ee9ab1, #b98add);
}

.timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  gap: 18px;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: -26px;
  top: 8px;
  width: 18px;
  height: 18px;
  border: 4px solid #fff;
  border-radius: 50%;
  background: #e97996;
  box-shadow: 0 0 0 2px rgba(233, 121, 150, 0.28);
}

.timeline-item time {
  color: #9b6274;
  font-weight: 800;
}

.timeline-content {
  position: relative;
  padding: 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 14px 34px rgba(121, 68, 84, 0.08);
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.timeline-actions {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  max-width: calc(100% - 24px);
}

.btn.timeline-delete-btn {
  padding: 0.22rem 0.5rem;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.2;
  color: #fff;
  background: linear-gradient(135deg, #c9789a 0%, #9a6a9c 100%);
  border: 1px solid rgba(90, 50, 80, 0.2);
  border-radius: 999px;
  box-shadow: 0 1px 4px rgba(90, 50, 80, 0.12);
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease, box-shadow 0.15s ease;
  white-space: nowrap;
}

.btn.timeline-delete-btn:hover {
  filter: brightness(1.05);
  box-shadow: 0 2px 8px rgba(90, 50, 80, 0.18);
  transform: translateY(-1px);
}

.btn.timeline-delete-btn:active {
  transform: translateY(0);
}

.timeline-item-meta {
  margin: 12px 0 0;
  font-size: 0.82rem;
  color: #9b6274;
}

.timeline-content h3,
.timeline-content p {
  margin: 0;
}

.timeline-content h3 {
  color: #5c3140;
  padding-right: 4.5rem;
  max-width: 100%;
  box-sizing: border-box;
}

.timeline-content p {
  margin-top: 8px;
  color: #765c66;
}

.letter-wrap {
  display: grid;
  justify-items: center;
  gap: 22px;
}

.envelope-card {
  position: relative;
  width: min(100%, 680px);
  min-height: 400px;
  padding: 98px 30px 34px;
  border-radius: 28px;
  background: linear-gradient(145deg, #ffdce7, #fff8ef);
  box-shadow: 0 26px 70px rgba(121, 68, 84, 0.14);
  overflow: hidden;
}

.envelope-flap {
  position: absolute;
  inset: 0 0 auto;
  height: 160px;
  background: linear-gradient(135deg, #f2a7bb, #d9b7f1);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
}

.letter-paper {
  position: relative;
  z-index: 2;
  max-width: 520px;
  min-height: 210px;
  margin: 0 auto;
  padding: 28px;
  border-radius: 18px;
  color: #5c3140;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 18px 45px rgba(121, 68, 84, 0.12);
  font-size: 18px;
}

.letter-paper.locked {
  display: grid;
  place-items: center;
  text-align: center;
  font-weight: 800;
}

.letter-paper.open p {
  margin: 0 0 14px;
}

/* Form Messages & States */
.form-message {
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 6px;
  font-size: 0.9rem;
  text-align: center;
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  color: var(--text-color);
}

.form-message.success {
  background-color: rgba(94, 203, 142, 0.1);
  border-color: #5ecb8e;
  color: #2b7a4b;
}

.form-message.error {
  background-color: rgba(228, 86, 126, 0.1);
  border-color: #e4567e;
  color: #a42c4b;
}

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
  font-size: 1rem;
  background-color: var(--card-bg);
  border-radius: 12px;
  border: 1px dashed var(--border-color);
}

.btn.primary.is-loading {
  opacity: 0.7;
  cursor: not-allowed;
  pointer-events: none;
}

@media (max-width: 820px) {
  .navbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .nav-links {
    justify-content: flex-start;
  }

  .hero {
    grid-template-columns: 1fr;
    min-height: auto;
    padding-top: 36px;
  }

  .hero-tree {
    height: 330px;
  }

  .cards-grid,
  .memory-grid,
  .notes-grid {
    grid-template-columns: 1fr;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .photo-tree {
    min-height: 480px;
  }

  .tree-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .planet-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .tree-actions {
    width: 100%;
  }

  .planet-actions {
    width: 100%;
  }

  .tree-actions .btn {
    flex: 1 1 150px;
  }

  .planet-actions .btn {
    flex: 1 1 150px;
  }

  .tree-toolbar .btn {
    width: 100%;
  }

  .planet-toolbar .btn {
    width: 100%;
  }

  .tree-3d-stage,
  .premium-tree-stage {
    height: 420px;
    margin: 14px;
  }

  .premium-tree-stage {
    height: 460px;
    border-radius: 22px;
  }

  .planet-stage {
    height: 460px;
    margin: 14px;
    border-radius: 22px;
  }

  .tree-canopy {
    height: 330px;
  }

  .tree-trunk {
    height: 220px;
    width: 86px;
  }

  .timeline-item {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}

@media (max-width: 520px) {
  .container {
    width: min(100% - 22px, 1100px);
  }

  .nav-links a {
    padding: 7px 9px;
    font-size: 13px;
  }

  .hero h1,
  .page-title h1 {
    font-size: 34px;
  }

  .card,
  .login-card {
    padding: 18px;
    border-radius: 18px;
  }

  .hero-actions,
  .btn {
    width: 100%;
  }

  .photo-tree {
    min-height: 410px;
  }

  .tree-toolbar {
    padding: 18px 18px 0;
  }

  .planet-toolbar {
    padding: 18px 18px 0;
  }

  .tree-3d-stage,
  .premium-tree-stage {
    height: 420px;
    border-radius: 18px;
  }

  .premium-tree-stage {
    height: 460px;
    margin: 12px;
  }

  .planet-stage {
    height: 460px;
    margin: 12px;
    border-radius: 18px;
  }

  .tree-3d-hint {
    right: 10px;
    bottom: 10px;
    max-width: calc(100% - 20px);
  }

  .planet-hint {
    right: 10px;
    bottom: 10px;
    max-width: calc(100% - 20px);
  }

  .tree-canopy {
    top: 18px;
    height: 280px;
  }

  .tree-trunk {
    bottom: 48px;
    height: 180px;
  }

  .tree-ground {
    bottom: 28px;
  }

  .memory-node {
    width: 26px;
    height: 26px;
  }

  .envelope-card {
    min-height: 340px;
    padding: 82px 16px 24px;
  }
}

/* Memory card delete — soft rose, matches site palette */
.btn.btn-danger,
.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.28rem 0.55rem;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.2;
  color: #fff;
  background: linear-gradient(135deg, #c9789a 0%, #a85d8c 100%);
  border: 1px solid rgba(120, 60, 90, 0.22);
  border-radius: 999px;
  box-shadow: 0 1px 4px rgba(120, 60, 90, 0.12);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
  max-width: calc(100% - 16px);
  white-space: nowrap;
}

.btn.btn-danger:hover,
.btn-danger:hover {
  filter: brightness(1.06);
  box-shadow: 0 2px 10px rgba(120, 60, 90, 0.2);
  transform: translateY(-1px);
}

.btn.btn-danger:active,
.btn-danger:active {
  transform: translateY(0);
}

.memory-delete-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 10;
}

/* —— 时光信箱 / 星球邮筒 —— */
.letter-layout {
  max-width: 920px;
  margin: 0 auto;
}

.mailbox-card {
  background: linear-gradient(165deg, rgba(255, 248, 252, 0.95), rgba(245, 236, 255, 0.88));
  border: 1px solid rgba(210, 170, 200, 0.35);
  box-shadow: 0 18px 48px rgba(120, 70, 100, 0.1);
}

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

.mailbox-head h2 {
  margin: 0;
  color: #6b3d52;
}

.mailbox-toolbar {
  margin-bottom: 14px;
}

.activity-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.22rem 0.65rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #e090ab, #b98add);
  border-radius: 999px;
}

.activity-list {
  display: grid;
  gap: 12px;
}

.activity-item {
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(200, 160, 185, 0.28);
  box-shadow: 0 8px 22px rgba(90, 50, 70, 0.06);
  max-width: 100%;
  overflow-wrap: anywhere;
}

.activity-item.unread {
  border-color: rgba(220, 140, 175, 0.55);
  box-shadow: 0 10px 26px rgba(200, 110, 150, 0.12);
  background: rgba(255, 242, 248, 0.85);
}

.activity-item-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  align-items: baseline;
}

.activity-item-head strong {
  color: #5c3140;
  font-size: 1rem;
}

.activity-item-time {
  font-size: 0.78rem;
  color: #9b6274;
}

.activity-body {
  margin: 8px 0 0;
  color: #765c66;
  font-size: 0.92rem;
}

.activity-item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.btn-small {
  padding: 0.35rem 0.65rem;
  font-size: 0.8rem;
}

.mailbox-empty-hint {
  text-align: center;
  padding: 1rem;
}

.letter-compose-card h2 {
  margin-top: 0;
  color: #6b3d52;
}

.letter-in-out {
  margin-top: 8px;
}

.letter-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.letter-tab {
  padding: 0.45rem 1rem;
  border-radius: 999px;
  border: 1px solid rgba(190, 140, 165, 0.35);
  background: rgba(255, 255, 255, 0.65);
  color: #765c66;
  cursor: pointer;
  font: inherit;
  transition: background 0.15s ease, transform 0.15s ease;
}

.letter-tab.active {
  background: linear-gradient(135deg, #ffdce8, #e8d6ff);
  color: #5c3140;
  font-weight: 700;
  border-color: rgba(200, 130, 170, 0.45);
}

.letter-list {
  display: grid;
  gap: 16px;
}

.letter-card {
  border-radius: 20px;
  padding: 2px;
  background: linear-gradient(135deg, rgba(255, 200, 215, 0.55), rgba(210, 190, 245, 0.45));
  box-shadow: 0 14px 36px rgba(110, 60, 90, 0.1);
  max-width: 100%;
}

.letter-card-inner {
  border-radius: 18px;
  padding: 18px 18px 16px;
  background: linear-gradient(180deg, #fffdfb 0%, #fff6fa 100%);
  min-width: 0;
}

.letter-card-locked .letter-card-inner {
  background: linear-gradient(180deg, #faf8ff 0%, #fff5fb 100%);
}

.letter-card h3 {
  margin: 0 0 8px;
  color: #5c3140;
  font-size: 1.15rem;
}

.letter-card-meta {
  margin: 0 0 10px;
  font-size: 0.82rem;
  color: #9b6274;
}

.letter-status {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}

.letter-status-pill {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: rgba(230, 200, 230, 0.55);
  color: #6b4a6f;
}

.letter-status-open {
  font-size: 0.72rem;
  color: #2b7a4b;
  font-weight: 700;
}

.letter-status-locked {
  font-size: 0.72rem;
  color: #a85d8c;
  font-weight: 700;
}

.letter-status-muted {
  font-size: 0.75rem;
  color: #9b6274;
}

.letter-locked-reason {
  margin: 6px 0 0;
  width: 100%;
  font-size: 0.85rem;
  color: #876070;
}

.letter-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.letter-modal .letter-modal-panel {
  max-width: min(96vw, 560px);
  max-height: min(88vh, 640px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.letter-modal-body {
  overflow-y: auto;
  max-height: min(72vh, 520px);
}

.letter-modal-content {
  margin-top: 14px;
  line-height: 1.75;
  color: #46343b;
  white-space: pre-wrap;
  word-break: break-word;
}

@media (max-width: 600px) {
  .mailbox-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }
  .mailbox-actions {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }
  .mailbox-actions .btn {
    flex: 1 1 auto;
    min-width: 0;
  }
  .activity-actions {
    justify-content: flex-start;
  }
  .activity-actions .btn {
    flex: 1 1 140px;
    min-width: 0;
  }
}

.mailbox-page .mailbox-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:12px; }
.mailbox-toolbar { display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap; }
.mailbox-count { font-weight:600; color:#5b3b67; }
.mailbox-clear-btn { background:#ff6b81; color:#fff; border:none; }
.activity-list { display:flex; flex-direction:column; gap:10px; }
.mailbox-card.activity-item { padding:12px; border-radius:10px; background:linear-gradient(180deg, #fff, #fffafc); box-shadow:0 6px 18px rgba(160,120,150,0.06); position:relative; }
.activity-item.unread { box-shadow: 0 8px 20px rgba(250,150,180,0.08); border:1px solid rgba(255,180,200,0.12); }
.activity-type-badge { display:inline-block; padding:4px 8px; background:#f8e7f0; color:#c14f7a; border-radius:12px; font-size:0.8rem; margin-right:8px; }
.activity-title { font-weight:600; margin-top:6px; }
.activity-body { color:#5b4a5b; margin-top:6px; }
.activity-time { font-size:0.85rem; color:#8b7b8b; margin-top:8px; }
.activity-actions { margin-top:8px; display:flex; gap:8px; flex-wrap:wrap; }
.activity-empty { text-align:center; color:#7a6b7a; padding:24px; }

.mailbox-expand-btn { background:#6f65a6; color:#fff; border:none; padding:8px 14px; border-radius:8px; }
.mailbox-expand-btn:hover { opacity:0.95; }

/* ========== Letter viewer：信封动画 + 大尺寸阅读态 ========== */
.letter-viewer {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(20px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right))
    max(20px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
  box-sizing: border-box;
}

.letter-viewer.hidden {
  display: none !important;
}

.letter-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(74, 42, 58, 0.45);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0;
  transition: opacity 0.35s ease;
}

.letter-viewer.is-visible .letter-backdrop {
  opacity: 1;
}

.letter-viewer.is-closing .letter-backdrop {
  opacity: 0;
}

.letter-stage {
  position: relative;
  z-index: 2;
  width: min(960px, 94vw);
  max-width: min(920px, 92vw);
  height: min(84vh, 900px);
  max-height: min(82vh, 900px);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  opacity: 0;
  transform: translateY(20px);
  transition:
    opacity 0.4s ease,
    transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.letter-viewer.is-visible .letter-stage {
  opacity: 1;
  transform: translateY(0);
}

.letter-viewer.is-closing .letter-stage {
  opacity: 0;
  transform: translateY(16px);
}

.letter-close-btn {
  position: absolute;
  top: max(18px, env(safe-area-inset-top));
  right: max(18px, env(safe-area-inset-right));
  z-index: 30;
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 252, 253, 0.96);
  color: #6a3d52;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 10px 32px rgba(121, 68, 84, 0.2);
  transition: transform 0.2s ease, background 0.2s ease;
}

.letter-close-btn:hover {
  transform: scale(1.05);
  background: #fff;
}

.letter-viewer .envelope-scene {
  position: relative;
  width: 100%;
  flex: 1;
  min-height: 0;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 1000px;
  perspective-origin: 50% 42%;
}

.letter-viewer-cluster {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: min(62vh, 520px);
}

/* 阶段 A：信封 */
.letter-viewer .envelope {
  position: absolute;
  left: 50%;
  top: 54%;
  width: min(400px, 56vw);
  height: min(260px, 30vh);
  transform: translate(-50%, -50%) scale(0.78);
  transform-style: preserve-3d;
  opacity: 0;
  z-index: 4;
  transition:
    transform 0.5s cubic-bezier(0.34, 1.12, 0.64, 1),
    opacity 0.4s ease,
    top 0.4s ease;
}

.letter-viewer.phase-env-in .envelope {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}

.letter-viewer.is-reading .envelope {
  opacity: 0;
  transform: translate(-50%, -44%) scale(0.86);
  pointer-events: none;
  transition: opacity 0.32s ease, transform 0.38s ease;
}

.letter-viewer .envelope-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
}

.letter-viewer .envelope-body {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 68%;
  background: linear-gradient(165deg, #fffafd 0%, #fdeef4 48%, #f5e0eb 100%);
  border-radius: 3px 3px 16px 16px;
  border: 1px solid rgba(232, 176, 198, 0.55);
  box-shadow:
    0 16px 40px rgba(121, 68, 84, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.88);
  z-index: 1;
}

.letter-viewer .envelope-body::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, transparent 38%, rgba(255, 255, 255, 0.42) 50%, transparent 62%);
  opacity: 0.4;
  pointer-events: none;
}

.letter-viewer .letter-viewer-flap {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 56%;
  background: linear-gradient(180deg, #fff6fa 0%, #edd0df 100%);
  clip-path: polygon(0 0, 50% 96%, 100% 0);
  transform-origin: 50% 0;
  transform: rotateX(0deg);
  transition: transform 0.52s cubic-bezier(0.45, 0, 0.22, 1), opacity 0.28s ease;
  z-index: 6;
  border-bottom: 1px solid rgba(210, 160, 182, 0.4);
  box-shadow: 0 -4px 18px rgba(135, 61, 85, 0.08);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.letter-viewer.phase-flap-open .letter-viewer-flap {
  transform: rotateX(-175deg);
}

.letter-viewer.is-reading .letter-viewer-flap {
  opacity: 0;
}

/* 信纸：自小而大，终态为阅读面板 */
.letter-viewer .letter-viewer-paper {
  position: absolute;
  left: 50%;
  top: 52%;
  width: min(300px, 70vw);
  height: min(168px, 24vh);
  max-height: 30vh;
  transform: translate(-50%, -4%) scale(0.92);
  transform-origin: 50% 100%;
  z-index: 3;
  background: linear-gradient(180deg, #fffefb 0%, #fff8f4 100%);
  border-radius: 12px;
  border: 1px solid rgba(214, 182, 196, 0.42);
  box-shadow: 0 8px 28px rgba(70, 52, 59, 0.12);
  opacity: 0;
  transition:
    transform 0.52s cubic-bezier(0.33, 1, 0.68, 1),
    width 0.48s cubic-bezier(0.33, 1, 0.68, 1),
    height 0.48s cubic-bezier(0.33, 1, 0.68, 1),
    max-height 0.48s ease,
    top 0.48s ease,
    opacity 0.35s ease,
    box-shadow 0.42s ease,
    border-radius 0.32s ease;
}

.letter-viewer.phase-env-in .letter-viewer-paper {
  opacity: 1;
}

.letter-viewer.phase-paper-out .letter-viewer-paper {
  z-index: 8;
  top: 42%;
  width: min(560px, 88vw);
  height: min(380px, 48vh);
  max-height: 52vh;
  transform: translate(-50%, -38%) scale(1);
  box-shadow: 0 22px 56px rgba(94, 58, 74, 0.2);
}

.letter-viewer.phase-content-visible .letter-viewer-paper {
  border-radius: 16px;
}

.letter-viewer.is-reading .letter-viewer-paper {
  top: 50%;
  left: 50%;
  width: min(760px, 84vw);
  max-width: min(760px, 84vw);
  height: min(72vh, 720px);
  max-height: min(70vh, 720px);
  transform: translate(-50%, -50%) scale(1);
  box-shadow: 0 28px 72px rgba(74, 48, 62, 0.24);
  z-index: 12;
  border-radius: 18px;
}

.letter-viewer-paper-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: 100%;
  padding: 26px 30px 28px;
  box-sizing: border-box;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.36s ease 0.05s;
  -webkit-overflow-scrolling: touch;
}

.letter-viewer.phase-content-visible .letter-viewer-paper-inner,
.letter-viewer.is-reading .letter-viewer-paper-inner {
  opacity: 1;
}

.letter-viewer.is-reading .letter-viewer-paper-inner {
  padding: 40px 42px 44px;
}

.letter-viewer-paper-header h3 {
  margin: 0 0 12px;
  font-size: clamp(1.2rem, 2.4vw, 1.65rem);
  color: #5c3140;
  font-weight: 800;
  line-height: 1.28;
  flex-shrink: 0;
}

.letter-viewer.is-reading .letter-viewer-paper-header h3 {
  font-size: clamp(1.65rem, 3vw, 2rem);
}

.letter-viewer-meta {
  font-size: 0.95rem;
  color: #6f5560;
  margin: 0 0 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

.letter-viewer-meta-sep {
  opacity: 0.5;
}

.letter-viewer-paper-content {
  flex: 1;
  min-height: 0;
  margin: 0;
  overflow-y: auto;
  overflow-x: hidden;
  font-size: 18px;
  line-height: 1.9;
  color: #453239;
  white-space: pre-wrap;
  word-break: break-word;
}

.letter-card-highlight {
  outline: 2px solid rgba(200, 120, 160, 0.5);
  outline-offset: 3px;
  border-radius: 14px;
  animation: letter-card-highlight-pulse 1.1s ease-in-out 2;
}

@keyframes letter-card-highlight-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(216, 112, 160, 0.22);
  }
  50% {
    box-shadow: 0 0 0 10px rgba(216, 112, 160, 0.05);
  }
}

@media (max-width: 768px) {
  .letter-viewer {
    padding: 12px;
  }

  .letter-stage {
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
  }

  .letter-viewer-cluster {
    min-height: 0;
  }

  .letter-viewer .envelope {
    width: min(340px, 88vw);
    height: min(220px, 28vh);
    top: 50%;
  }

  .letter-viewer .letter-viewer-paper {
    width: min(90vw, 540px);
  }

  .letter-viewer.phase-paper-out .letter-viewer-paper {
    width: min(92vw, 560px);
    height: min(40vh, 420px);
    max-height: 46vh;
  }

  .letter-viewer.is-reading .letter-viewer-paper {
    width: min(92vw, 560px);
    height: min(76vh, 720px);
    max-height: min(76vh, 720px);
  }

  .letter-viewer-paper-inner {
    padding: 22px 18px 24px;
  }

  .letter-viewer.is-reading .letter-viewer-paper-inner {
    padding: 24px 20px 28px;
  }

  .letter-viewer-paper-header h3 {
    font-size: clamp(1.2rem, 5vw, 1.55rem);
  }

  .letter-viewer.is-reading .letter-viewer-paper-header h3 {
    font-size: 1.5rem;
  }

  .letter-viewer-paper-content {
    font-size: 16px;
    line-height: 1.85;
  }

  .letter-close-btn {
    top: max(14px, env(safe-area-inset-top));
    right: max(14px, env(safe-area-inset-right));
    width: 46px;
    height: 46px;
    font-size: 24px;
  }
}

/* —— 账号设置 —— */
.account-page {
  padding-bottom: 3rem;
}

.account-page .page-title p {
  color: rgba(88, 52, 86, 0.82);
  max-width: 36rem;
}

.account-card {
  margin-bottom: 1.25rem;
  border-radius: 18px;
  box-shadow: 0 12px 36px rgba(180, 120, 160, 0.12);
}

.account-card h2 {
  margin-top: 0;
  font-size: 1.15rem;
  color: #6b3d62;
}

.account-global-msg {
  margin-bottom: 1rem;
}

.account-info-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.5rem 1.25rem;
  margin: 0;
}

.account-info-grid dt {
  margin: 0;
  font-weight: 600;
  color: rgba(107, 61, 98, 0.75);
}

.account-info-grid dd {
  margin: 0;
  color: #4a3045;
}

.account-hint {
  margin: 0 0 1rem;
  font-size: 0.9rem;
  color: rgba(88, 52, 86, 0.72);
}

.account-form .btn {
  margin-top: 0.25rem;
}

.account-section .form-message {
  margin-top: 0.75rem;
}

@media (max-width: 640px) {
  .account-info-grid {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }

  .account-info-grid dt {
    margin-top: 0.5rem;
  }

  .account-info-grid dt:first-child {
    margin-top: 0;
  }
}

/* —— 云相册 / Photo Tree —— */
.featured-toolbar {
  align-items: flex-start;
}

.featured-toolbar .planet-actions {
  flex-wrap: wrap;
  gap: 0.5rem;
}

.album-section {
  margin-bottom: 1.25rem;
}

.album-create-form {
  margin-bottom: 1rem;
}

.album-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.album-pill {
  border: 1px solid rgba(214, 140, 180, 0.45);
  background: rgba(255, 252, 254, 0.92);
  color: #6b3d62;
  border-radius: 999px;
  padding: 0.45rem 0.95rem;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
}

.album-pill:hover {
  background: rgba(255, 236, 244, 0.95);
  box-shadow: 0 4px 14px rgba(200, 120, 160, 0.12);
}

.album-pill.active {
  background: linear-gradient(135deg, rgba(255, 182, 210, 0.55), rgba(230, 190, 255, 0.45));
  border-color: rgba(200, 100, 150, 0.35);
  font-weight: 600;
}

.album-pill-count {
  opacity: 0.75;
  font-weight: 400;
}

.cloud-gallery {
  margin-bottom: 2.5rem;
}

.cloud-gallery-hint {
  margin: 0 0 1rem;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.1rem;
}

.gallery-empty {
  padding: 1.5rem 0;
}

.gallery-card {
  background: rgba(255, 252, 254, 0.96);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 10px 28px rgba(180, 120, 160, 0.1);
  border: 1px solid rgba(230, 180, 210, 0.25);
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
}

.gallery-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 36px rgba(180, 120, 160, 0.16);
}

.gallery-card-image-wrap {
  aspect-ratio: 4 / 3;
  background: linear-gradient(160deg, #fff5f9, #f8e8f2);
  overflow: hidden;
}

.gallery-card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gallery-card-meta {
  padding: 0.85rem 1rem 1rem;
}

.gallery-card-meta h3 {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  color: #5a2d52;
}

.gallery-card-meta p {
  margin: 0.2rem 0;
  font-size: 0.85rem;
  color: rgba(80, 45, 75, 0.82);
  line-height: 1.45;
}

.gallery-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.65rem;
}

.gallery-card-actions .btn {
  font-size: 0.82rem;
  padding: 0.35rem 0.65rem;
}

.download-original-btn {
  text-decoration: none;
  display: inline-block;
  text-align: center;
}

.modal-download-wrap {
  margin-top: 1rem;
}

@media (max-width: 520px) {
  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.75rem;
  }

  .album-list {
    gap: 0.4rem;
  }

  .album-pill {
    font-size: 0.82rem;
    padding: 0.38rem 0.75rem;
  }
}
