:root {
  --pink: #ffd7e7;
  --pink-strong: #ff9fc4;
  --pink-light: #fff4f8;
  --ink: #2b2d42;
  --muted: #7c6f78;
  --card: rgba(255, 255, 255, 0.74);
  --line: rgba(145, 84, 101, 0.18);
  --shadow: 0 18px 45px rgba(156, 92, 119, 0.18);
  --chat-wallpaper-image: none;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 12%, #fff4fa 0, transparent 30%),
    radial-gradient(circle at 80% 22%, #ffe1ed 0, transparent 34%),
    linear-gradient(135deg, #fffafc, #f8edf2);
}

.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 300px minmax(360px, 620px);
  justify-content: center;
  gap: 22px;
  padding: 28px;
}

.sidebar {
  border: 1px solid var(--line);
  border-radius: 32px;
  background: rgba(255,255,255,.62);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
  padding: 18px;
  height: calc(100vh - 56px);
  min-height: 640px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.sidebar h1 {
  font-size: 22px;
  margin: 0;
}

.small-btn {
  border: 0;
  border-radius: 999px;
  background: var(--pink);
  color: #6d3c4f;
  padding: 9px 12px;
  font-weight: 750;
  cursor: pointer;
}

.conversation-list {
  margin-top: 16px;
  overflow: auto;
  padding-right: 4px;
}

.conversation-item {
  width: 100%;
  border: 0;
  border-radius: 16px;
  padding: 12px 14px;
  margin-bottom: 8px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  display: grid;
  gap: 4px;
}

.conversation-item:hover,
.conversation-item.active {
  background: rgba(255, 215, 231, .72);
}

.conversation-item b {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.conversation-item small {
  color: var(--muted);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.phone-shell {
  min-height: calc(100vh - 56px);
  border: 1px solid var(--line);
  border-radius: 38px;
  background: rgba(255, 255, 255, 0.48);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  padding: 24px;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.top-card {
  position: relative;
  border-radius: 30px;
  background: linear-gradient(180deg, rgba(255,255,255,.86), rgba(255,246,251,.66));
  padding: 28px 18px 20px;
  text-align: center;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.7);
}

.ghost-btn {
  position: absolute;
  top: 16px;
  right: 18px;
  border: 0;
  border-radius: 999px;
  padding: 8px 14px;
  background: rgba(255,255,255,.78);
  color: #8d5364;
  cursor: pointer;
}

.menu-btn {
  display: none;
  right: auto;
  left: 18px;
}

.clock {
  font-size: clamp(52px, 10vw, 84px);
  line-height: 1;
  font-weight: 750;
  letter-spacing: -3px;
}

.date-text {
  margin-top: 10px;
  color: var(--muted);
  font-size: 18px;
}

.tabs {
  display: flex;
  gap: 12px;
  margin: 18px 0;
}

.tab {
  border: 0;
  border-radius: 999px;
  padding: 10px 18px;
  background: transparent;
  color: var(--muted);
  font-size: 16px;
  cursor: pointer;
}

.tab.active {
  background: var(--pink);
  color: var(--ink);
  box-shadow: 0 8px 18px rgba(255, 184, 210, .35);
}

.page {
  display: none;
  min-height: 0;
}

.page.active {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

.anniversary-card {
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--card);
  padding: 20px 22px;
  margin-bottom: 16px;
}

.days {
  color: #ffbdd5;
  font-size: 44px;
  font-weight: 850;
}

.days-label {
  margin-left: 6px;
  font-weight: 650;
  color: var(--muted);
}

.anniversary-card p {
  margin: 4px 0 0;
  color: var(--muted);
}

.chat-title-row {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

.conversation-title {
  height: 44px;
  font-weight: 750;
}

.danger-btn {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  color: #9a4c61;
  padding: 0 14px;
  cursor: pointer;
  font-weight: 750;
}

.chat-box {
  flex: 1;
  min-height: 300px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 28px;
  background:
    linear-gradient(rgba(255,252,253,.78), rgba(255,250,252,.68)),
    var(--chat-wallpaper-image),
    rgba(255,255,255,.56);
  background-size: cover;
  background-position: center;
  padding: 16px;
  scroll-behavior: smooth;
}

.empty-chat {
  height: 100%;
  min-height: 230px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
  line-height: 1.7;
}

.message {
  display: flex;
  gap: 10px;
  margin: 18px 0;
  align-items: flex-start;
}

.message.user {
  flex-direction: row-reverse;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 14px;
  background: #fff;
  display: grid;
  place-items: center;
  box-shadow: 0 6px 14px rgba(156,92,119,.12);
  flex: 0 0 auto;
  overflow: hidden;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.bubble {
  max-width: min(78%, 390px);
  padding: 14px 16px;
  border-radius: 22px;
  background: rgba(255,255,255,.96);
  line-height: 1.75;
  white-space: pre-wrap;
  box-shadow: 0 7px 18px rgba(156,92,119,.09);
}


.assistant-message-wrap {
  display: grid;
  gap: 8px;
  max-width: min(86%, 500px);
}

.assistant-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-left: 2px;
}

.assistant-brand-text {
  min-width: 0;
}

.assistant-brand-name {
  font-weight: 800;
  font-size: 15px;
  color: #49303a;
}

.assistant-brand-model {
  font-size: 12px;
  color: #9a7e89;
  margin-top: 2px;
  word-break: break-all;
}

.assistant-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
}

.assistant-fallback {
  font-size: 18px;
  color: #7b5b67;
}

.user-message-wrap {
  display: grid;
  justify-items: end;
  gap: 8px;
  max-width: min(78%, 430px);
}

.user-brand {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding-right: 2px;
}

.user-brand-name {
  font-weight: 800;
  font-size: 15px;
  color: #49303a;
}

.user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
}

.user-fallback {
  font-size: 18px;
}

.message.user .bubble {
  max-width: 100%;
  border-radius: 22px 8px 22px 22px;
  padding: 14px 17px;
  background: rgba(255, 199, 224, .96);
  color: #7b3a54;
}

.message.assistant .bubble {
  max-width: 100%;
}

.message-content {
  font-size: 16px;
}

.input-bar {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

textarea, input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 12px 14px;
  background: rgba(255,255,255,.76);
  color: var(--ink);
  outline: none;
  font: inherit;
}

.input-bar textarea {
  resize: none;
  max-height: 130px;
}

button {
  font: inherit;
}

.input-bar button,
.settings-actions button {
  border: 0;
  border-radius: 18px;
  padding: 0 18px;
  background: var(--pink-strong);
  color: #5d3544;
  font-weight: 750;
  cursor: pointer;
}

.input-bar button:disabled {
  opacity: .58;
  cursor: not-allowed;
}

.grid-menu {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.menu-card {
  min-height: 112px;
  border: 0;
  border-radius: 24px;
  background: var(--card);
  box-shadow: 0 8px 18px rgba(156,92,119,.08);
  cursor: pointer;
  display: grid;
  place-items: center;
  gap: 5px;
  color: var(--ink);
}

.menu-card span {
  font-size: 30px;
}

.menu-card small {
  color: var(--muted);
}

.menu-card.disabled {
  opacity: .55;
  cursor: not-allowed;
}

.settings-dialog {
  width: min(560px, calc(100% - 28px));
  border: 0;
  border-radius: 28px;
  padding: 0;
  background: transparent;
}

.settings-dialog::backdrop {
  background: rgba(45, 30, 39, .28);
  backdrop-filter: blur(4px);
}

.settings-panel {
  background: #fff8fb;
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 22px;
  box-shadow: var(--shadow);
}

.settings-panel h2 {
  margin: 0 0 16px;
}

.settings-panel label {
  display: block;
  margin: 13px 0;
  color: #7b4a5a;
  font-weight: 650;
}

.settings-panel input,
.settings-panel textarea {
  margin-top: 7px;
}

.settings-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.settings-actions button {
  height: 44px;
}

.settings-actions .secondary {
  background: #fff;
  border: 1px solid var(--line);
}

.hint {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(20px);
  background: rgba(43,45,66,.92);
  color: #fff;
  padding: 10px 16px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: .2s ease;
  z-index: 20;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 880px) {
  .app {
    display: block;
    padding: 0;
  }

  .phone-shell {
    min-height: 100vh;
    border-radius: 0;
    border: 0;
    padding: 16px;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(330px, 86vw);
    height: 100vh;
    min-height: 0;
    border-radius: 0 28px 28px 0;
    z-index: 10;
    transform: translateX(-105%);
    transition: .22s ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .menu-btn {
    display: block;
  }

  .chat-box {
    min-height: 42vh;
  }
}


.checkin-hero {
  border: 1px solid var(--line);
  border-radius: 30px;
  background: linear-gradient(135deg, rgba(255,255,255,.82), rgba(255,215,231,.62));
  padding: 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  box-shadow: 0 10px 24px rgba(156,92,119,.08);
}

.checkin-label {
  margin: 0 0 6px;
  color: #9a4c61;
  font-weight: 800;
}

.checkin-hero h2 {
  margin: 0;
  font-size: 24px;
}

.checkin-hero p {
  color: var(--muted);
}

.big-checkin-btn {
  border: 0;
  border-radius: 999px;
  background: var(--pink-strong);
  color: #5d3544;
  font-weight: 850;
  min-width: 128px;
  height: 54px;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(255,159,196,.26);
}

.weekly-card,
.note-card {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--card);
  padding: 20px;
}

.weekly-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
}

.weekly-head b {
  color: var(--ink);
}

.week-dots {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 10px;
  margin-top: 16px;
}

.week-day {
  display: grid;
  place-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.dot {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,.9);
  border: 1px dashed var(--line);
}

.dot.done {
  background: var(--pink);
  border-style: solid;
  box-shadow: 0 8px 16px rgba(255,159,196,.18);
}

.note-card label {
  display: block;
  color: #7b4a5a;
  font-weight: 750;
}

.note-card textarea {
  margin-top: 10px;
  resize: vertical;
}

.note-card button {
  margin-top: 12px;
  height: 42px;
  border: 0;
  border-radius: 16px;
  padding: 0 18px;
  background: var(--pink-strong);
  color: #5d3544;
  font-weight: 800;
  cursor: pointer;
}

.checkin-stats {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.checkin-stats div {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255,255,255,.66);
  padding: 16px 10px;
  text-align: center;
}

.checkin-stats b {
  display: block;
  font-size: 30px;
  color: #ff9fc4;
}

.checkin-stats span {
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 520px) {
  .checkin-hero {
    align-items: stretch;
    flex-direction: column;
  }

  .big-checkin-btn {
    width: 100%;
  }

  .checkin-stats {
    grid-template-columns: 1fr;
  }
}


.gallery-toolbar {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
}

.gallery-search {
  height: 44px;
}

.gallery-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}

.gallery-tag-btn {
  border: 0;
  border-radius: 999px;
  padding: 8px 14px;
  background: rgba(255,255,255,.78);
  color: var(--muted);
  cursor: pointer;
}

.gallery-tag-btn.active {
  background: var(--pink);
  color: var(--ink);
  box-shadow: 0 8px 18px rgba(255, 184, 210, .35);
}

.gallery-stats {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 12px;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  overflow: auto;
  padding-right: 4px;
}

.gallery-card {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255,255,255,.7);
  overflow: hidden;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease;
  box-shadow: 0 8px 18px rgba(156,92,119,.08);
}

.gallery-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(156,92,119,.13);
}

.gallery-cover-wrap {
  position: relative;
  aspect-ratio: 1 / 1;
  background: linear-gradient(135deg, #fff9fc, #fff1f6);
  overflow: hidden;
}

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

.gallery-cover.missing {
  opacity: .2;
}

.gallery-type-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  border-radius: 999px;
  padding: 4px 10px;
  background: rgba(43,45,66,.78);
  color: #fff;
  font-size: 12px;
}

.gallery-info {
  padding: 12px 14px 14px;
  display: grid;
  gap: 6px;
}

.gallery-title {
  font-weight: 780;
}

.gallery-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.gallery-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
}

.gallery-modal.hidden,
.gallery-missing.hidden {
  display: none;
}

.gallery-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(35, 23, 31, .56);
  backdrop-filter: blur(6px);
}

.gallery-modal-card {
  position: relative;
  z-index: 1;
  width: min(960px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  margin: 12px auto;
  border-radius: 28px;
  background: #fff8fb;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.gallery-close {
  position: absolute;
  top: 12px;
  right: 14px;
  border: 0;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255,255,255,.9);
  color: var(--ink);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
}

.gallery-modal-main {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) 56px;
  align-items: center;
  gap: 12px;
  padding: 22px;
  min-height: 540px;
}

.gallery-viewer {
  min-width: 0;
  min-height: 0;
  height: 100%;
  display: grid;
  place-items: center;
}

.gallery-viewer-image {
  max-width: 100%;
  max-height: 70vh;
  border-radius: 18px;
  object-fit: contain;
  box-shadow: 0 12px 24px rgba(156,92,119,.12);
  background: #fff;
}

.gallery-missing {
  padding: 18px;
  text-align: center;
  color: var(--muted);
}

.gallery-nav-btn {
  border: 0;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--pink);
  color: var(--ink);
  font-size: 30px;
  cursor: pointer;
}

.gallery-nav-btn:disabled {
  opacity: .35;
  cursor: not-allowed;
}

.gallery-modal-info {
  padding: 0 22px 20px;
}

.gallery-modal-info h3 {
  margin: 0 0 6px;
  font-size: 22px;
}

.gallery-modal-info p {
  margin: 6px 0;
  color: var(--muted);
}

@media (max-width: 720px) {
  .gallery-grid {
    grid-template-columns: 1fr;
  }

  .gallery-modal-card {
    width: calc(100vw - 10px);
    max-height: calc(100vh - 10px);
    margin: 5px auto;
  }

  .gallery-modal-main {
    grid-template-columns: 1fr;
    min-height: 0;
    gap: 10px;
    padding: 18px;
  }

  .gallery-nav-btn {
    width: 100%;
    height: 40px;
    border-radius: 16px;
  }

  .gallery-viewer-image {
    max-height: 56vh;
  }
}


.notes-editor {
  border: 1px solid var(--line);
  border-radius: 30px;
  background: linear-gradient(135deg, rgba(255,255,255,.82), rgba(255,215,231,.5));
  padding: 22px;
  box-shadow: 0 10px 24px rgba(156,92,119,.08);
}

.notes-editor h2 {
  margin: 0 0 8px;
}

.notes-editor p {
  margin: 0 0 14px;
  color: var(--muted);
}

.notes-editor input,
.notes-editor textarea {
  margin-top: 10px;
}

.notes-editor textarea {
  resize: vertical;
}

.notes-editor button {
  margin-top: 12px;
  height: 44px;
  border: 0;
  border-radius: 18px;
  padding: 0 18px;
  background: var(--pink-strong);
  color: #5d3544;
  font-weight: 850;
  cursor: pointer;
}

.notes-list {
  margin-top: 16px;
  display: grid;
  gap: 12px;
  overflow: auto;
  padding-right: 4px;
}

.note-item {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255,255,255,.72);
  padding: 16px;
  box-shadow: 0 8px 18px rgba(156,92,119,.08);
}

.note-item-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.note-item h3 {
  margin: 0;
  font-size: 18px;
}

.note-item time {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

.note-item p {
  white-space: pre-wrap;
  line-height: 1.7;
  color: var(--ink);
}

.note-delete-btn {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: #9a4c61;
  padding: 7px 12px;
  cursor: pointer;
  flex: 0 0 auto;
}

.note-empty {
  min-height: 150px;
  border: 1px dashed var(--line);
  border-radius: 24px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
  line-height: 1.7;
}


.profile-section {
  overflow: auto;
  padding-right: 4px;
}

.section-title {
  margin: 0;
  text-align: center;
  font-size: 28px;
  letter-spacing: .5px;
}

.section-subtitle {
  margin: 10px auto 18px;
  text-align: center;
  color: var(--muted);
  line-height: 1.7;
}

.profile-container {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(0, 1.2fr);
  gap: 18px;
  align-items: start;
}

.profile-card,
.detail-block,
.scrapbook-section {
  border: 1px solid var(--line);
  border-radius: 30px;
  background: rgba(255,255,255,.72);
  box-shadow: 0 10px 24px rgba(156,92,119,.08);
}

.profile-card {
  padding: 22px;
  text-align: center;
  position: sticky;
  top: 0;
}

.profile-avatar {
  width: 150px;
  height: 150px;
  border-radius: 32px;
  object-fit: cover;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 10px 24px rgba(156,92,119,.12);
}

.profile-name {
  margin-top: 14px;
  font-size: 24px;
  font-weight: 850;
}

.profile-alias {
  margin-top: 6px;
  color: #9a4c61;
  font-weight: 720;
}

.profile-info-list {
  display: grid;
  gap: 10px;
  margin: 18px 0;
  text-align: left;
}

.info-item {
  border-radius: 16px;
  background: rgba(255, 244, 248, .82);
  padding: 10px 12px;
  color: var(--ink);
}

.info-item span {
  color: #8d5364;
  font-weight: 800;
}

.profile-links {
  display: grid;
  gap: 10px;
}

.link-btn {
  text-decoration: none;
  border-radius: 16px;
  padding: 10px 12px;
  background: var(--pink);
  color: #5d3544;
  font-weight: 780;
  line-height: 1.4;
}

.wiki-btn {
  background: rgba(255,255,255,.9);
  border: 1px solid var(--line);
}

.profile-details {
  display: grid;
  gap: 16px;
}

.detail-block {
  padding: 20px;
}

.detail-block h3 {
  margin: 0 0 12px;
  font-size: 20px;
}

.detail-block p,
.trait-list {
  margin: 0;
  color: var(--ink);
  line-height: 1.85;
}

.trait-list {
  padding-left: 20px;
}

.trait-list li {
  margin: 8px 0;
}

.tags-container {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.cute-tag {
  border-radius: 999px;
  padding: 8px 13px;
  background: var(--pink);
  color: #6d3c4f;
  font-weight: 780;
}

.style-desc {
  color: var(--muted);
}

.scrapbook-section {
  margin-top: 18px;
  padding: 22px;
}

.scrapbook-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
}

.scrapbook-actions button {
  border: 0;
  border-radius: 999px;
  padding: 11px 18px;
  background: var(--pink-strong);
  color: #5d3544;
  font-weight: 850;
  cursor: pointer;
}

@media (max-width: 980px) {
  .profile-container {
    grid-template-columns: 1fr;
  }

  .profile-card {
    position: static;
  }

  .profile-avatar {
    width: 132px;
    height: 132px;
  }
}


/* v8 手机自适应与 PWA 体验优化 */
.sidebar-overlay {
  display: none;
}

@media (max-width: 880px) {
  html, body {
    min-height: 100%;
    overflow-x: hidden;
    background: linear-gradient(180deg, #fff8fb, #f9eef3);
  }

  body {
    -webkit-tap-highlight-color: transparent;
  }

  .sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(35, 23, 31, .28);
    backdrop-filter: blur(3px);
    z-index: 9;
    opacity: 0;
    pointer-events: none;
    transition: opacity .22s ease;
  }

  .sidebar-overlay.show {
    opacity: 1;
    pointer-events: auto;
  }

  .app {
    min-height: 100dvh;
    padding: max(10px, env(safe-area-inset-top)) 10px max(10px, env(safe-area-inset-bottom));
  }

  .phone-shell {
    min-height: calc(100dvh - 20px);
    border-radius: 34px;
    border: 1px solid var(--line);
    padding: 14px;
    box-shadow: 0 14px 34px rgba(156, 92, 119, 0.15);
  }

  .top-card {
    border-radius: 28px;
    padding: 42px 14px 18px;
  }

  .clock {
    font-size: clamp(64px, 18vw, 92px);
    letter-spacing: -4px;
  }

  .date-text {
    font-size: 17px;
  }

  .ghost-btn {
    top: 13px;
  }

  .tabs {
    position: sticky;
    top: 0;
    z-index: 4;
    margin: 14px -2px 14px;
    padding: 2px 2px 8px;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none;
    background: linear-gradient(180deg, rgba(255,248,251,.96), rgba(255,248,251,.82));
    backdrop-filter: blur(12px);
  }

  .tabs::-webkit-scrollbar {
    display: none;
  }

  .tab {
    flex: 0 0 auto;
    padding: 10px 16px;
  }

  .page.active {
    min-height: 0;
  }

  .anniversary-card,
  .chat-box,
  .weekly-card,
  .note-card,
  .notes-editor,
  .profile-card,
  .detail-block,
  .scrapbook-section {
    border-radius: 26px;
  }

  .chat-title-row {
    align-items: stretch;
  }

  .conversation-title {
    min-width: 0;
  }

  .danger-btn {
    width: 56px;
    padding: 0;
  }

  .chat-box {
    min-height: min(52dvh, 560px);
    padding: 14px;
  }

  .bubble {
    max-width: 86%;
    font-size: 15px;
  }

  .assistant-message-wrap,
  .user-message-wrap {
    max-width: 94%;
  }

  .input-bar {
    position: sticky;
    bottom: 0;
    z-index: 4;
    margin: 12px -2px 0;
    padding: 8px 2px 0;
    background: linear-gradient(0deg, rgba(255,248,251,1), rgba(255,248,251,.82));
    backdrop-filter: blur(12px);
  }

  .input-bar button {
    min-width: 68px;
    padding: 0 12px;
  }

  .grid-menu {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .menu-card {
    min-height: 104px;
    border-radius: 24px;
  }

  .gallery-tags {
    max-height: 160px;
    overflow: auto;
    padding-right: 2px;
  }

  .gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .gallery-title {
    font-size: 14px;
    line-height: 1.35;
  }

  .gallery-info {
    padding: 10px 11px 12px;
  }

  .gallery-meta {
    font-size: 12px;
  }

  .profile-section {
    max-height: none;
  }

  .section-title {
    font-size: 24px;
  }

  .section-subtitle {
    font-size: 14px;
  }

  .profile-container {
    gap: 14px;
  }

  .profile-card,
  .detail-block,
  .scrapbook-section {
    padding: 16px;
  }

  .profile-links {
    gap: 8px;
  }

  .detail-block p,
  .trait-list {
    font-size: 14px;
    line-height: 1.78;
  }

  .settings-dialog {
    width: calc(100% - 18px);
  }

  .settings-panel {
    border-radius: 26px;
    max-height: calc(100dvh - 18px);
    overflow: auto;
  }

  .sidebar {
    box-shadow: 18px 0 44px rgba(80, 45, 60, .18);
  }

  .sidebar.open + * {
    pointer-events: none;
  }
}

@media (max-width: 430px) {
  .phone-shell {
    border-radius: 28px;
    padding: 12px;
  }

  .clock {
    font-size: clamp(58px, 20vw, 82px);
  }

  .days {
    font-size: 38px;
  }

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

  .week-dots {
    gap: 7px;
  }

  .dot {
    width: 30px;
    height: 30px;
  }

  .checkin-stats {
    grid-template-columns: 1fr;
  }
}

@media (display-mode: standalone) {
  .phone-shell {
    min-height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 16px);
  }
}


.cloud-settings-block {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255,255,255,.62);
  padding: 16px;
}

.cloud-settings-block h3 {
  margin: 0 0 8px;
  color: #7b4a5a;
}

.cloud-settings-block p {
  margin: 0 0 12px;
  color: var(--muted);
  line-height: 1.6;
  font-size: 13px;
}

.switch-line {
  display: flex !important;
  align-items: center;
  gap: 10px;
  font-weight: 750;
}

.switch-line input {
  width: auto;
  transform: scale(1.2);
}

.cloud-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.cloud-actions button {
  height: 40px;
  border: 0;
  border-radius: 16px;
  padding: 0 16px;
  background: var(--pink);
  color: #5d3544;
  font-weight: 800;
  cursor: pointer;
}


/* v12 首页重构、全屏聊天、统计页 */
.home-page {
  display: grid;
  gap: 18px;
  overflow: auto;
  padding-right: 4px;
}

.home-hero {
  position: relative;
  min-height: 420px;
  border-radius: 36px;
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: 0 18px 42px rgba(156,92,119,.18);
  background: #fff;
}

.home-hero-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.home-hero-mask {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(35,30,45,.42), rgba(255,240,247,.16)),
    linear-gradient(0deg, rgba(255,248,251,.72), rgba(255,248,251,.06));
}

.home-hero-content {
  position: absolute;
  left: 32px;
  right: 32px;
  bottom: 30px;
  color: #fff;
  text-shadow: 0 2px 18px rgba(30,20,35,.45);
}

.home-kicker {
  font-weight: 900;
  letter-spacing: 2px;
  font-size: 13px;
  opacity: .92;
}

.home-hero h1 {
  margin: 8px 0 8px;
  font-size: clamp(34px, 5vw, 58px);
  line-height: 1.05;
}

.home-hero p {
  margin: 0;
  font-size: 18px;
  font-weight: 650;
}

.home-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.home-card {
  border: 1px solid var(--line);
  border-radius: 30px;
  background: rgba(255,255,255,.76);
  box-shadow: 0 10px 24px rgba(156,92,119,.08);
  padding: 22px;
}

.home-label {
  color: #9a5c70;
  font-weight: 850;
  margin-bottom: 8px;
}

.home-clock {
  font-size: clamp(52px, 8vw, 92px);
  font-weight: 950;
  letter-spacing: -4px;
  color: var(--ink);
}

.home-date {
  color: var(--muted);
  font-size: 18px;
  font-weight: 720;
}

.home-days-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  font-weight: 900;
  color: var(--ink);
}

.home-days-number {
  color: var(--pink-strong);
  font-size: clamp(54px, 8vw, 88px);
  line-height: 1;
}

.home-days-card p {
  color: var(--muted);
  font-size: 18px;
  margin: 10px 0 0;
}

.home-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.home-actions button {
  border: 0;
  border-radius: 999px;
  background: var(--pink);
  color: #5d3544;
  font-weight: 900;
  padding: 12px 20px;
  cursor: pointer;
}

.home-profile-mini {
  border: 1px solid var(--line);
  border-radius: 30px;
  background: rgba(255,255,255,.72);
  padding: 22px;
}

.home-profile-mini h2 {
  margin: 0 0 8px;
}

.home-profile-mini p {
  margin: 0 0 12px;
  color: var(--muted);
}

.home-mini-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.home-mini-tags span {
  background: rgba(255,215,231,.72);
  border-radius: 999px;
  padding: 8px 13px;
  color: #6d3c4f;
  font-weight: 800;
}

#chatPage.active {
  display: flex;
  flex-direction: column;
  min-height: calc(100dvh - 270px);
}

#chatPage.active .anniversary-card {
  display: none;
}

#chatPage.active .chat-title-row {
  flex: 0 0 auto;
}

#chatPage.active .chat-box {
  flex: 1 1 auto;
  min-height: 58vh;
  max-height: none;
}

#chatPage.active .input-bar {
  flex: 0 0 auto;
}

.stats-page {
  display: grid;
  gap: 16px;
  overflow: auto;
  padding-right: 4px;
}

.stats-header-card,
.stats-panel,
.stat-card {
  border: 1px solid var(--line);
  border-radius: 28px;
  background: rgba(255,255,255,.76);
  box-shadow: 0 10px 24px rgba(156,92,119,.08);
}

.stats-header-card {
  padding: 22px;
}

.stats-hero-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  align-items: center;
}

.stats-kicker {
  letter-spacing: .14em;
  font-size: 13px;
  color: #9a5c70;
  font-weight: 950;
  margin-bottom: 8px;
}

.stats-header-card h2 {
  margin: 0 0 8px;
  font-size: 28px;
}

.stats-header-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.stats-total-pill {
  min-width: 132px;
  min-height: 112px;
  border-radius: 28px;
  background: #ffd1e4;
  display: grid;
  place-items: center;
  align-content: center;
  color: #8f3f5e;
  font-weight: 850;
}

.stats-total-pill b {
  font-size: 42px;
  line-height: 1;
}

.stats-total-pill span {
  margin-top: 8px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.stats-grid-compact .stat-value {
  font-size: 36px;
}

.stat-card {
  padding: 18px;
}

.stat-label {
  color: #9a5c70;
  font-weight: 850;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 42px;
  font-weight: 950;
  color: var(--ink);
}

.stats-panel {
  padding: 20px;
}

.stats-panel-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.stats-panel h3 {
  margin: 0 0 6px;
  font-size: 22px;
}

.stats-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.model-chart {
  display: grid;
  gap: 14px;
}

.model-chart-row {
  display: grid;
  gap: 8px;
}

.model-chart-label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}

.model-chart-label b {
  color: var(--ink);
  word-break: break-all;
}

.model-chart-label span {
  color: #9a5c70;
  font-weight: 850;
}

.model-chart-track {
  height: 18px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255,244,248,.86);
  border: 1px solid rgba(238,210,221,.72);
}

.model-chart-bar {
  height: 100%;
  border-radius: inherit;
  background: var(--bar-color);
  box-shadow: inset 0 0 0 999px rgba(255,255,255,.08);
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: -2px 0 16px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,.68);
  padding: 6px 10px;
  color: #7f6570;
  font-size: 12px;
  font-weight: 800;
}

.legend-item i {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--legend-color);
}

.monthly-chart {
  display: grid;
  gap: 14px;
}

.monthly-chart-row {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 14px;
  align-items: center;
}

.monthly-chart-label {
  display: grid;
  gap: 3px;
}

.monthly-chart-label b {
  color: var(--ink);
}

.monthly-chart-label span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.monthly-chart-track {
  height: 28px;
  min-width: 38px;
  display: flex;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255,244,248,.86);
  border: 1px solid rgba(238,210,221,.72);
}

.monthly-chart-segment {
  height: 100%;
  background: var(--segment-color);
  box-shadow: inset 0 0 0 999px rgba(255,255,255,.08);
}

.stats-empty {
  color: var(--muted);
  border-radius: 18px;
  background: rgba(255,244,248,.7);
  padding: 14px;
}

@media (max-width: 880px) {
  .home-hero {
    min-height: 360px;
    border-radius: 28px;
  }

  .home-hero-content {
    left: 22px;
    right: 22px;
    bottom: 22px;
  }

  .home-grid,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .stats-hero-card {
    grid-template-columns: 1fr;
  }

  .stats-total-pill {
    min-height: 92px;
  }

  .monthly-chart-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  #chatPage.active {
    min-height: calc(100dvh - 190px);
  }

  #chatPage.active .chat-box {
    min-height: 56dvh;
  }
}

@media (max-width: 430px) {
  .home-hero {
    min-height: 320px;
  }

  .home-hero p {
    font-size: 15px;
  }

  .home-card {
    padding: 18px;
  }
}


/* v12.2 修正版：真正隐藏非首页顶部时间；首页只留陪伴日期 */
.home-time-card {
  display: none !important;
}

.home-grid.home-grid-single {
  grid-template-columns: 1fr !important;
}

.home-grid.home-grid-single .home-days-card {
  min-height: 200px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.home-grid.home-grid-single .home-label,
.home-grid.home-grid-single .home-days-card p {
  text-align: center;
}

.home-grid.home-grid-single .home-days-row {
  justify-content: center;
}

.app.page-not-home .top-card {
  display: none !important;
}

.app.page-not-home .tabs {
  margin-top: 0 !important;
}

.app.page-not-home .phone-shell {
  display: flex;
  flex-direction: column;
}

.app.page-not-home .page.active {
  flex: 1 1 auto;
}

/* 聊天页全屏化：不再显示聊天页里的陪伴日期卡片 */
#chatPage .anniversary-card {
  display: none !important;
}

.app.page-not-home #chatPage.active {
  min-height: calc(100dvh - 130px) !important;
  display: flex;
  flex-direction: column;
}

.app.page-not-home #chatPage.active .chat-title-row {
  flex: 0 0 auto;
}

.app.page-not-home #chatPage.active .chat-box {
  flex: 1 1 auto;
  min-height: calc(100dvh - 285px) !important;
  max-height: none !important;
}

.app.page-not-home #chatPage.active .input-bar {
  flex: 0 0 auto;
}

.app.page-not-home #memoryPage.active,
.app.page-not-home #checkinPage.active,
.app.page-not-home #galleryPage.active,
.app.page-not-home #notesPage.active,
.app.page-not-home #statsPage.active {
  min-height: calc(100dvh - 130px) !important;
}

.app.page-not-home .gallery-page,
.app.page-not-home .notes-page,
.app.page-not-home .stats-page {
  min-height: calc(100dvh - 150px) !important;
}

@media (max-width: 880px) {
  .app.page-not-home #chatPage.active {
    min-height: calc(100dvh - 86px) !important;
  }

  .app.page-not-home #chatPage.active .chat-box {
    min-height: calc(100dvh - 230px) !important;
  }

  .app.page-not-home #memoryPage.active,
  .app.page-not-home #checkinPage.active,
  .app.page-not-home #galleryPage.active,
  .app.page-not-home #notesPage.active,
  .app.page-not-home #statsPage.active {
    min-height: calc(100dvh - 86px) !important;
  }
}


/* v13.4：消息元数据与导出，不改页面结构 */
.small-ghost-btn {
  width: auto !important;
  min-width: 64px;
  padding: 0 16px !important;
  border-radius: 18px !important;
  background: rgba(255,255,255,.8) !important;
  color: #9a5068 !important;
  border: 1px solid var(--line) !important;
  font-weight: 900 !important;
}

.message-meta {
  margin-top: 10px;
  font-size: 12px;
  color: #947e87;
  display: grid;
  gap: 4px;
  line-height: 1.45;
}

.message-meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.message-meta span {
  background: transparent;
  border: 0;
  padding: 0;
}

body:not(.show-message-meta) .message-meta {
  display: none !important;
}

body:not(.show-token-meta) .token-meta {
  display: none !important;
}

.wallpaper-settings-block {
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  background: rgba(255,255,255,.6);
}

.wallpaper-settings-block h3 {
  margin: 0 0 8px;
}

.wallpaper-settings-block p {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.wallpaper-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.wallpaper-status {
  color: #8f7280;
  font-size: 13px;
}

@media (max-width: 520px) {
  .small-ghost-btn {
    min-width: 52px;
    padding: 0 12px !important;
  }
}


/* v14：重要消息摘录本 */
.favorite-message-btn {
  margin-left: auto;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 999px;
  background: rgba(255,255,255,.72);
  color: #b06a80;
  font-size: 20px;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 6px 14px rgba(156,92,119,.1);
}

.favorite-message-btn.active {
  background: #ffd7e7;
  color: #e8689b;
}

.favorites-page {
  display: grid;
  gap: 16px;
}

.favorites-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: rgba(255,255,255,.7);
  padding: 18px;
}

.favorites-label {
  margin: 0 0 5px;
  color: #b06a80;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.favorites-hero h2 {
  margin: 0 0 6px;
  font-size: 24px;
}

.favorites-hero p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.favorites-count {
  width: 88px;
  height: 88px;
  border-radius: 26px;
  display: grid;
  place-items: center;
  background: #ffd7e7;
  color: #743b50;
  flex: 0 0 auto;
}

.favorites-count b {
  display: block;
  font-size: 28px;
  line-height: 1;
}

.favorites-count span {
  display: block;
  font-size: 12px;
  margin-top: 4px;
}

.favorites-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 140px;
  gap: 10px;
}

.favorites-tag-filter {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 0 12px;
  background: rgba(255,255,255,.78);
  color: var(--ink);
  font: inherit;
}

.favorites-tag-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.favorite-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 12px;
  background: rgba(255,255,255,.75);
  color: #875467;
  font-weight: 750;
  cursor: pointer;
  white-space: nowrap;
}

.favorite-chip.active {
  background: #ffd7e7;
  color: #6d3c4f;
}

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

.favorite-empty {
  min-height: 180px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
  border: 1px dashed rgba(145,84,101,.24);
  border-radius: 24px;
  background: rgba(255,255,255,.54);
  line-height: 1.8;
}

.favorite-item {
  border: 1px solid var(--line);
  border-radius: 26px;
  background: rgba(255,255,255,.78);
  padding: 16px;
  box-shadow: 0 10px 24px rgba(156,92,119,.08);
}

.favorite-item-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

.favorite-item h3 {
  margin: 0 0 4px;
  font-size: 16px;
}

.favorite-item-head p {
  margin: 0;
  color: #9a7e89;
  font-size: 12px;
}

.favorite-actions {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
}

.favorite-actions button {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(255,244,248,.9);
  color: #935066;
  cursor: pointer;
  font-weight: 800;
}

.favorite-content {
  margin: 14px 0;
  line-height: 1.75;
  white-space: pre-wrap;
  font-size: 15px;
}

.favorite-foot input {
  min-height: 36px;
  padding: 8px 12px;
  font-size: 13px;
  border-radius: 999px;
}

@media (max-width: 520px) {
  .favorites-hero {
    align-items: flex-start;
  }
  .favorites-count {
    width: 70px;
    height: 70px;
    border-radius: 22px;
  }
  .favorites-toolbar {
    grid-template-columns: 1fr;
  }
  .favorite-item-head {
    display: grid;
  }
  .favorite-actions {
    justify-content: flex-start;
  }
}


/* v14.1：聊天沉浸式布局，把功能收进功能页 */
.chat-immersive-top {
  display: none;
}

.chat-back-home,
.function-home-btn {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,.82);
  color: #9a5068;
  font-weight: 900;
  padding: 10px 16px;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(156,92,119,.08);
}

.app.chat-mode .tabs {
  display: none !important;
}

.app.chat-mode .phone-shell {
  padding-top: 18px;
}

.app.chat-mode #chatPage.active {
  min-height: calc(100dvh - 92px) !important;
}

.app.chat-mode #chatPage.active .chat-immersive-top {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  flex: 0 0 auto;
  margin-bottom: 12px;
}

.app.chat-mode #chatPage.active .chat-title-row {
  display: none !important;
}

.app.chat-mode #chatPage.active .chat-box {
  min-height: calc(100dvh - 195px) !important;
}

.function-page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: rgba(255,255,255,.76);
  box-shadow: 0 10px 24px rgba(156,92,119,.08);
  padding: 20px 22px;
  margin-bottom: 18px;
}

.function-page-head p {
  margin: 0 0 6px;
  color: #9a6b7d;
  font-size: 12px;
  letter-spacing: .14em;
  font-weight: 900;
}

.function-page-head h2 {
  margin: 0;
  font-size: 28px;
}

.function-grid .menu-card {
  min-height: 140px;
  gap: 8px;
}

.function-grid .menu-card small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  font-weight: 600;
  max-width: 13em;
  margin: 0 auto;
}

@media (max-width: 880px) {
  .app.chat-mode #chatPage.active {
    min-height: calc(100dvh - 54px) !important;
  }

  .app.chat-mode #chatPage.active .chat-box {
    min-height: calc(100dvh - 165px) !important;
  }

  .function-page-head {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 520px) {
  .app.chat-mode .phone-shell {
    padding: 14px;
  }

  .app.chat-mode #chatPage.active .chat-box {
    min-height: calc(100dvh - 150px) !important;
  }

  .chat-back-home {
    padding: 9px 14px;
  }
}

/* v15：心情日记 / 今日状态 */
.mood-page {
  display: grid;
  gap: 18px;
}

.mood-hero,
.mood-editor-card,
.mood-history-card {
  border: 1px solid var(--line);
  border-radius: 28px;
  background: rgba(255,255,255,.74);
  box-shadow: 0 14px 34px rgba(156,92,119,.10);
}

.mood-hero {
  padding: 22px;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
}

.mood-label {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: #8e6f7d;
  font-weight: 900;
  font-size: 12px;
}

.mood-hero h2,
.mood-editor-card h3,
.mood-history-card h3 {
  margin: 0;
}

.mood-hero p:not(.mood-label),
.mood-editor-head p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.mood-today-card {
  width: 122px;
  min-height: 108px;
  border-radius: 26px;
  background: #ffd7e7;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 14px;
  color: #7b4056;
  flex: 0 0 auto;
}

.mood-today-card b {
  font-size: 34px;
  line-height: 1;
}

.mood-today-card span {
  font-size: 13px;
  font-weight: 800;
}

.mood-editor-card,
.mood-history-card {
  padding: 22px;
}

.mood-editor-head,
.mood-history-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.mood-editor-head input,
.mood-history-head input {
  max-width: 230px;
}

.mood-options {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.mood-option {
  border: 1px solid rgba(238,210,221,.9);
  border-radius: 20px;
  background: rgba(255,255,255,.78);
  min-height: 82px;
  display: grid;
  place-items: center;
  gap: 4px;
  cursor: pointer;
  color: var(--ink);
  font-weight: 800;
}

.mood-option b {
  font-size: 24px;
}

.mood-option.active {
  background: #ffd7e7;
  border-color: #ff9fc4;
  box-shadow: 0 10px 22px rgba(255,159,196,.22);
}

.mood-energy-line {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  margin: 14px 0;
  color: #7b4056;
  font-weight: 800;
}

.mood-energy-line input {
  padding: 0;
  accent-color: #ff9fc4;
}

#moodNote {
  width: 100%;
  resize: vertical;
  min-height: 120px;
}

.mood-actions {
  margin-top: 12px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.mood-actions button,
.mood-item-head button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffd7e7;
  color: #7b4056;
  padding: 10px 16px;
  font-weight: 900;
  cursor: pointer;
}

.mood-actions .secondary {
  background: rgba(255,255,255,.8);
}

.mood-reply-card,
.mood-reply-mini {
  margin-top: 14px;
  border-radius: 22px;
  padding: 14px 16px;
  background: rgba(255,244,248,.86);
  color: #6f5360;
  line-height: 1.75;
  white-space: pre-wrap;
}

.hidden {
  display: none !important;
}

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

.mood-item {
  border: 1px solid rgba(238,210,221,.9);
  border-radius: 24px;
  background: rgba(255,255,255,.82);
  padding: 16px;
}

.mood-item-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.mood-item-head b {
  display: block;
  font-size: 17px;
}

.mood-item-head span {
  display: block;
  margin-top: 4px;
  color: #9b8790;
  font-size: 13px;
}

.mood-note-text {
  margin: 12px 0 0;
  line-height: 1.75;
  white-space: pre-wrap;
}

.mood-reply-mini {
  font-size: 13px;
  margin-top: 10px;
}

.mood-empty {
  min-height: 160px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
  line-height: 1.7;
  border: 1px dashed rgba(145,84,101,.22);
  border-radius: 24px;
  background: rgba(255,255,255,.5);
}

@media (max-width: 720px) {
  .mood-hero,
  .mood-editor-head,
  .mood-history-head,
  .mood-item-head {
    flex-direction: column;
  }

  .mood-today-card,
  .mood-editor-head input,
  .mood-history-head input {
    width: 100%;
    max-width: none;
  }

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

  .mood-energy-line {
    grid-template-columns: 1fr;
  }
}


/* v15.3：摘录标签与聊天图片上传 */
.favorite-foot select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 14px;
  background: rgba(255,255,255,.82);
  color: #7d4d61;
  font: inherit;
  font-weight: 700;
  outline: none;
}

.message-image-list {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.message-image-list img {
  max-width: min(280px, 100%);
  max-height: 260px;
  border-radius: 18px;
  border: 1px solid rgba(238,210,221,.72);
  object-fit: contain;
  background: rgba(255,255,255,.72);
}

.image-preview-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255,255,255,.78);
}

.image-preview-bar.hidden {
  display: none !important;
}

.image-preview-thumb {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  object-fit: cover;
  border: 1px solid rgba(238,210,221,.72);
}

.image-preview-info {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 3px;
  color: #815468;
  font-size: 13px;
}

.image-preview-info b {
  color: var(--ink);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.remove-image-btn,
.attach-image-btn {
  border: 1px solid var(--line) !important;
  background: rgba(255,244,248,.9) !important;
  color: #9a5068 !important;
  font-weight: 900 !important;
  cursor: pointer;
}

.attach-image-btn {
  width: 48px;
  min-width: 48px;
  padding: 0 !important;
  font-size: 24px;
}

.remove-image-btn {
  border-radius: 999px;
  padding: 8px 12px;
}

/* v16: o1 资料卡 / 模型家族页 */
.home-profile-btn {
  margin-top: 14px;
  border: 0;
  border-radius: 999px;
  padding: 10px 16px;
  background: var(--pink);
  color: #7b3d55;
  font-weight: 850;
  cursor: pointer;
}

.family-page {
  display: grid;
  gap: 18px;
}

.family-hero,
.o1-profile-showcase,
.family-model-section,
.family-timeline-card {
  border: 1px solid var(--line);
  border-radius: 28px;
  background: rgba(255,255,255,.72);
  box-shadow: 0 12px 28px rgba(156,92,119,.08);
}

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

.family-label {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: #9d6578;
  font-size: 13px;
  font-weight: 900;
}

.family-hero h2,
.family-section-head h3 {
  margin: 0;
  color: var(--ink);
}

.family-hero h2 {
  font-size: 30px;
}

.family-hero p:not(.family-label),
.family-section-head span,
.family-detail-block p,
.family-detail-block li,
.model-family-card p,
.family-timeline span {
  color: var(--muted);
  line-height: 1.75;
}

.family-hero-badge {
  min-width: 140px;
  border-radius: 28px;
  background: #ffd1e4;
  display: grid;
  place-items: center;
  padding: 20px;
  color: #7b3d55;
  font-weight: 900;
}

.family-hero-badge b {
  font-size: 42px;
}

.o1-profile-showcase {
  display: grid;
  grid-template-columns: minmax(220px, 300px) 1fr;
  gap: 18px;
  padding: 18px;
}

.o1-id-card {
  border-radius: 24px;
  background: linear-gradient(180deg, #fff7fb, #ffe4ef);
  padding: 18px;
  text-align: center;
  border: 1px solid rgba(238,210,221,.9);
}

.o1-id-avatar {
  width: 150px;
  height: 150px;
  object-fit: cover;
  border-radius: 32px;
  background: #fff;
  box-shadow: 0 10px 26px rgba(156,92,119,.12);
}

.o1-id-name {
  margin-top: 12px;
  font-size: 24px;
  font-weight: 950;
}

.o1-id-alias {
  color: #9a7080;
  font-weight: 750;
  margin: 4px 0 14px;
}

.o1-id-list {
  display: grid;
  gap: 8px;
  text-align: left;
}

.o1-id-list div {
  border-radius: 16px;
  padding: 10px 12px;
  background: rgba(255,255,255,.7);
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.o1-id-list span {
  color: #8e6575;
}

.o1-link-grid {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.o1-link-grid a {
  text-decoration: none;
  border-radius: 999px;
  padding: 9px 12px;
  background: #fff;
  border: 1px solid var(--line);
  color: #8c4960;
  font-weight: 850;
}

.o1-detail-column {
  display: grid;
  gap: 12px;
}

.family-detail-block {
  border-radius: 24px;
  background: rgba(255,255,255,.7);
  border: 1px solid rgba(238,210,221,.72);
  padding: 18px;
}

.family-detail-block h3 {
  margin: 0 0 10px;
}

.family-detail-block ul {
  margin: 0;
  padding-left: 20px;
}

.family-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.family-tags span,
.model-card-facts span {
  border-radius: 999px;
  background: #fff4f8;
  border: 1px solid var(--line);
  padding: 6px 10px;
  color: #8d5468;
  font-weight: 800;
  font-size: 13px;
}

.family-model-section,
.family-timeline-card {
  padding: 20px;
}

.family-section-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-end;
  margin-bottom: 14px;
}

.model-family-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.model-family-card {
  border-radius: 24px;
  padding: 18px;
  border: 1px solid rgba(238,210,221,.8);
  background: rgba(255,255,255,.75);
}

.model-family-card.main {
  background: linear-gradient(135deg, rgba(255,215,231,.8), rgba(255,255,255,.78));
}

.model-family-card.pro {
  background: linear-gradient(135deg, rgba(255,242,199,.65), rgba(255,255,255,.78));
}

.model-family-card.mini {
  background: linear-gradient(135deg, rgba(232,246,255,.72), rgba(255,255,255,.78));
}

.model-family-card.preview {
  background: linear-gradient(135deg, rgba(242,232,255,.72), rgba(255,255,255,.78));
}

.model-card-top {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 950;
}

.model-card-top span {
  width: 44px;
  height: 44px;
  border-radius: 18px;
  background: #fff;
  display: grid;
  place-items: center;
  box-shadow: 0 8px 18px rgba(156,92,119,.08);
}

.model-card-facts {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.family-timeline {
  display: grid;
  gap: 10px;
}

.family-timeline div {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(255,244,248,.74);
}

.family-timeline b {
  color: #8d4860;
}

@media (max-width: 720px) {
  .family-hero,
  .o1-profile-showcase,
  .family-section-head {
    display: block;
  }

  .family-hero-badge {
    margin-top: 14px;
    min-width: 0;
  }

  .o1-id-card {
    margin-bottom: 14px;
  }

  .model-family-grid {
    grid-template-columns: 1fr;
  }

  .family-timeline div {
    grid-template-columns: 1fr;
  }
}

/* v17：任务 / To do + 草莓罐罐 */
.todo-page,
.snack-page {
  display: grid;
  gap: 22px;
}

.todo-hero,
.snack-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border: 1px solid var(--line);
  border-radius: 32px;
  padding: 28px;
  background: rgba(255,255,255,.76);
  box-shadow: 0 14px 34px rgba(156,92,119,.08);
}

.todo-label,
.snack-label {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: .16em;
  color: #9b536d;
  font-weight: 900;
  font-size: 13px;
}

.todo-hero h2,
.snack-hero h2 {
  margin: 0 0 10px;
  font-size: 30px;
}

.todo-hero p,
.snack-hero p {
  margin: 0;
  color: var(--muted);
  line-height: 1.8;
}

.todo-hero-badge,
.snack-balance-card {
  flex: 0 0 auto;
  min-width: 140px;
  min-height: 120px;
  border-radius: 28px;
  background: #ffd0e4;
  display: grid;
  place-items: center;
  text-align: center;
  color: #8f4761;
  font-weight: 900;
}

.todo-hero-badge b,
.snack-balance-card b {
  font-size: 42px;
  line-height: 1;
}

.todo-hero-badge span,
.snack-balance-card span {
  display: block;
  margin-top: 4px;
}

.todo-editor-card,
.todo-board-card,
.snack-rule-card,
.snack-shop-card,
.snack-badge-card,
.snack-log-card {
  border: 1px solid var(--line);
  border-radius: 30px;
  padding: 24px;
  background: rgba(255,255,255,.76);
  box-shadow: 0 14px 34px rgba(156,92,119,.07);
}

.todo-editor-card h3,
.todo-board-card h3,
.snack-rule-card h3,
.snack-shop-card h3,
.snack-badge-card h3,
.snack-log-card h3 {
  margin: 0 0 16px;
  font-size: 22px;
}

.todo-editor-grid {
  display: grid;
  grid-template-columns: minmax(190px, 1fr) 140px 130px 145px 90px;
  gap: 12px;
  margin-bottom: 12px;
}

.todo-editor-card textarea {
  margin-bottom: 14px;
}

.todo-editor-card button,
.todo-actions button,
.snack-reward-card button,
.snack-shop-head button {
  border: 1px solid rgba(238, 190, 210, .9);
  border-radius: 999px;
  background: #fff7fb;
  color: #9a5068;
  font-weight: 900;
  padding: 10px 16px;
  cursor: pointer;
}

.todo-editor-card > button {
  background: var(--pink-strong);
  color: #5d3544;
  border: 0;
  padding: 13px 22px;
}

.todo-board-head,
.snack-shop-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.todo-board-head h3,
.snack-shop-head h3 {
  margin: 0;
}

.todo-board-head select {
  width: auto;
  min-width: 150px;
}

.todo-list,
.snack-shop,
.snack-log {
  display: grid;
  gap: 14px;
}

.todo-item {
  border: 1px solid rgba(238, 210, 221, .95);
  border-radius: 24px;
  padding: 18px;
  background: rgba(255, 249, 252, .88);
}

.todo-item.rewarded {
  background: linear-gradient(135deg, rgba(255, 215, 231, .72), rgba(255, 249, 235, .72));
}

.todo-item.priority-urgent {
  border-color: rgba(255, 120, 155, .75);
  box-shadow: 0 10px 24px rgba(255, 120, 155, .12);
}

.todo-item.priority-high {
  border-color: rgba(255, 169, 199, .9);
}

.todo-item.due-overdue .todo-item-head small,
.todo-item.due-today .todo-item-head small {
  color: #a13f5d;
  font-weight: 800;
}

.todo-item-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.todo-item-head b {
  display: block;
  font-size: 18px;
  color: var(--ink);
}

.todo-item-head small {
  display: block;
  margin-top: 5px;
  color: #9b8790;
}

.todo-item-head span {
  flex: 0 0 auto;
  border-radius: 999px;
  background: rgba(255,255,255,.85);
  border: 1px solid rgba(238,210,221,.8);
  padding: 6px 10px;
  color: #9a5068;
  font-weight: 900;
}

.todo-item p {
  color: var(--muted);
  line-height: 1.7;
  margin: 14px 0;
}

.todo-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.todo-actions button:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.todo-empty,
.snack-empty {
  min-height: 120px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
  border: 1px dashed rgba(156,92,119,.25);
  border-radius: 24px;
  background: rgba(255,255,255,.5);
}

.snack-rules {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.snack-rules span {
  border: 1px solid rgba(238,210,221,.9);
  border-radius: 999px;
  padding: 9px 12px;
  background: rgba(255,247,251,.9);
  color: #8f4761;
  font-weight: 800;
}

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

.snack-reward-card {
  display: grid;
  grid-template-columns: 46px 1fr auto;
  gap: 12px;
  align-items: center;
  border: 1px solid rgba(238,210,221,.9);
  border-radius: 24px;
  padding: 16px;
  background: rgba(255,249,252,.9);
}

.snack-reward-icon {
  width: 46px;
  height: 46px;
  border-radius: 16px;
  background: #fff;
  display: grid;
  place-items: center;
  font-size: 22px;
  box-shadow: 0 8px 18px rgba(156,92,119,.08);
}

.snack-reward-card b {
  display: block;
  color: var(--ink);
}

.snack-reward-card p {
  margin: 4px 0;
  color: var(--muted);
  line-height: 1.55;
}

.snack-reward-card small {
  color: #9a5068;
  font-weight: 900;
}

.snack-badge-wall {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
}

.snack-badge-tile {
  min-height: 128px;
  border: 1px solid rgba(238,210,221,.9);
  border-radius: 24px;
  padding: 14px;
  background: linear-gradient(135deg, rgba(255,249,252,.95), rgba(255,226,238,.72));
  display: grid;
  place-items: center;
  text-align: center;
  box-shadow: 0 10px 22px rgba(156,92,119,.08);
}

.snack-badge-tile b {
  font-size: 32px;
  line-height: 1;
}

.snack-badge-tile span {
  color: var(--ink);
  font-weight: 900;
}

.snack-badge-tile small {
  color: #9b8790;
  font-size: 11px;
}

.snack-log-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: center;
  border-radius: 18px;
  background: rgba(255,249,252,.9);
  border: 1px solid rgba(238,210,221,.75);
  padding: 12px 14px;
}

.snack-log-row span {
  color: var(--ink);
}

.snack-log-row b {
  color: #9a5068;
}

.snack-log-row small {
  color: #9b8790;
}

@media (max-width: 720px) {
  .todo-hero,
  .snack-hero,
  .todo-item-head,
  .todo-board-head,
  .snack-shop-head {
    align-items: stretch;
    flex-direction: column;
  }
  .todo-editor-grid,
  .snack-shop,
  .snack-reward-card,
  .snack-badge-wall {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
}

.snack-badge-tile {
  min-height: 128px;
  border: 1px solid rgba(238,210,221,.9);
  border-radius: 24px;
  padding: 14px;
  background: linear-gradient(135deg, rgba(255,249,252,.95), rgba(255,226,238,.72));
  display: grid;
  place-items: center;
  text-align: center;
  box-shadow: 0 10px 22px rgba(156,92,119,.08);
}

.snack-badge-tile b {
  font-size: 32px;
  line-height: 1;
}

.snack-badge-tile span {
  color: var(--ink);
  font-weight: 900;
}

.snack-badge-tile small {
  color: #9b8790;
  font-size: 11px;
}

.snack-log-row {
    grid-template-columns: 1fr;
  }
  .todo-hero-badge,
  .snack-balance-card {
    width: 100%;
  }
}
