:root {
  --bg: #dfe4df;
  --panel: #f7f7f4;
  --line: #d6d9d3;
  --text: #1f2622;
  --muted: #6a746e;
  --wechat: #95ec69;
  --assistant-bubble: rgba(255, 255, 255, 0.8);
  --user-bubble: rgba(149, 236, 105, 0.8);
  --wechat-deep: #2f7d32;
  --white: #ffffff;
  --danger: #c94a43;
  --shadow: 0 18px 50px rgba(35, 43, 37, 0.18);
  --keyboard-offset: 0px;
}

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

html,
body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  user-select: none !important;
  -webkit-user-select: none !important;
  -webkit-touch-callout: none !important;
}

body {
  margin: 0;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  user-select: none !important;
  -webkit-user-select: none !important;
  -webkit-touch-callout: none !important;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.72), transparent 32rem),
    linear-gradient(145deg, #d7ded8, #eff1ec);
}

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

input,
textarea {
  user-select: text !important;
  -webkit-user-select: text !important;
  -webkit-touch-callout: default !important;
}

.hidden {
  display: none !important;
}

.phone-shell {
  width: min(100vw, 1200px);
  height: 100dvh;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 18px;
  padding: 18px 18px 8px;
  overscroll-behavior: none;
}

.chat-screen,
.drawer {
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgba(28, 37, 32, 0.1);
  background: rgba(247, 247, 244, 0.94);
  box-shadow: var(--shadow);
}

.chat-screen {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-rows: 44px minmax(0, 1fr) auto;
  border-radius: 8px;
  user-select: none !important;
  -webkit-user-select: none !important;
  -webkit-touch-callout: none !important;
}

.topbar {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 36px;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-bottom: 1px solid var(--line);
  background: #ededeb;
}

.topbar::after {
  content: none;
}

.conversation-home { min-height:0; height:100%; overflow:hidden; display:flex; flex-direction:column; background:#fff; border-radius:8px; border:1px solid var(--line); }
.conversation-home[hidden] { display:none; }
.conversation-home-header { flex:none; height:54px; display:flex; align-items:center; justify-content:space-between; padding:0 14px; background:#ededeb; border-bottom:1px solid var(--line); }
.conversation-home-header h1 { font-size:19px; margin:0; font-weight:600; }
.wechat-conversation-list { min-height:0; overflow:auto; flex:1; }
.wechat-chat-row { display:flex; align-items:center; gap:12px; width:100%; min-height:80px; text-align:left; padding:12px 16px; border:0; border-bottom:1px solid #eceeeb; background:#fff; color:var(--text); cursor:pointer; border-radius:0; }
.wechat-chat-row:active { background:#eceeeb; }
.conversation-avatar { flex:none; width:50px; height:50px; border-radius:7px; display:flex; align-items:center; justify-content:center; background:#7eaaa1; color:white; font-size:23px; overflow:hidden; }
.conversation-avatar img { width:100%; height:100%; object-fit:cover; }
.group-avatar { display:grid; grid-template-columns:1fr 1fr; gap:2px; background:#d8dfd9; padding:3px; }
.group-avatar .conversation-avatar { width:21px; height:21px; font-size:12px; border-radius:2px; }
.chat-row-info { flex:1; min-width:0; display:block; }
.chat-row-info strong,.chat-row-info small { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.chat-row-info strong { font-size:16px; font-weight:500; margin-bottom:7px; }
.chat-row-info small { font-size:13px; color:#8a918c; }
.chat-row-meta { align-self:stretch; display:flex; flex-direction:column; align-items:flex-end; gap:10px; padding-top:3px; font-size:11px; color:#a1a7a3; }
.chat-unread { border-radius:12px; min-width:17px; padding:1px 5px; text-align:center; background:#e75c56; color:white; font-size:11px; }
body.show-chat-home .phone-shell { grid-template-columns:minmax(0,1fr); max-width:800px; }
body.show-chat-home .chat-screen { display:none; }
body.show-chat-home .drawer:not(.open) { display:none; }
body.show-chat-home .drawer.open { display:grid; position:fixed; z-index:12; inset:0 0 0 auto; width:min(100vw,440px); height:100dvh; margin:0; border-radius:0; }
.member-settings-fields[hidden] { display:none; }
.member-settings-fields { display:grid; gap:8px; padding:10px 0 4px 22px; }
.member-settings-fields label { min-width:0; font-size:13px; display:grid; gap:4px; }
.member-settings-fields input[type=file] { max-width:100%; width:100%; font-size:12px; }
.member-message .avatar { background:#c08e86; }
.member-message-body { min-width:0; max-width:76%; }
.member-message-body .bubble { max-width:100%; background:rgba(255,255,255,.82); }
.member-speaker { color:#6d766e; font-size:11px; line-height:15px; margin:0 0 4px 2px; }
.phase-arrangements { padding:12px 0; border-bottom:1px solid var(--line); }
.phase-arrangements summary { cursor:pointer; font-weight:600; }
#lifeArrangementSummary { display:block; padding:5px 0 0 18px; font-weight:400; font-size:12px; color:var(--wechat-deep); line-height:1.5; }
#lifeArrangementSection { margin:0 0 16px; padding:12px; border:1px solid var(--line); border-radius:8px; background:var(--white); }
#lifeArrangementEmpty[hidden] { display:none; }
.phase-row { display:grid; grid-template-columns:1fr 1fr; gap:8px; padding:12px 0; border-top:1px solid var(--line); }
.phase-row>label:first-child,.phase-flags,.phase-row>button { grid-column:1/-1; }
.phase-row>label { display:grid; min-width:0; gap:4px; font-size:12px; }
.phase-row input[type=date] { min-width:0; width:100%; }
.phase-flags { display:flex; flex-wrap:wrap; gap:8px; font-size:12px; }
.phase-flags label { display:flex; align-items:center; gap:4px; }
.phase-flags input { width:auto; }
.phase-actions { display:flex; flex-wrap:wrap; gap:6px; }
.phase-actions button,.growth-row button { padding:7px 9px; font-size:12px; }
.growth-row { display:grid; grid-template-columns:minmax(0,1fr) 104px 48px; gap:6px; align-items:center; margin:12px 0; font-size:13px; }
.growth-row select { width:100%; min-width:0; padding:7px 4px; }
.account-security-dialog .growth-row button { padding:7px 4px; white-space:nowrap; font-size:12px; }
@media(max-width:700px) { body.show-chat-home .phone-shell { padding:0; } .conversation-home { border:0; border-radius:0; } }

.chat-list-button { width:36px; padding:4px 0; border:0; background:transparent; color:var(--text); font:inherit; font-size:12px; cursor:pointer; }
.partner-titles { min-width:0; text-align:center; }
.partner-titles .partner-name { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; max-width:65vw; }
.conversation-mini { max-width:65vw; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:var(--muted); font-size:10px; line-height:12px; }
.conversation-mini[hidden] { display:none; }
.conversation-list { display:grid; gap:8px; margin:12px 0; }
.conversation-list-row { display:flex; align-items:center; gap:6px; }
.conversation-list-row .conversation-choice { flex:1; min-width:0; text-align:left; }
.conversation-choice strong,.conversation-choice small { display:block; overflow-wrap:anywhere; }
.conversation-choice small { margin-top:5px; color:var(--muted); font-size:12px; }
.conversation-choice[aria-current=true] { border-color:var(--wechat-deep); }
.conversation-member-pick { padding:8px 0; border-bottom:1px solid var(--line); }
.conversation-member-pick > label:first-child { display:flex; align-items:center; gap:8px; }
.conversation-member-pick input[type=checkbox] { width:auto; margin:0; }
.conversation-birthday[hidden] { display:none; }

.icon-button {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-size: 19px;
  cursor: pointer;
}

.icon-button:hover {
  background: rgba(0, 0, 0, 0.06);
}

.partner-head {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.topbar .avatar {
  display: none;
}

.avatar {
  position: relative;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 7px;
  background: linear-gradient(135deg, #33413b, #789084);
  color: #fff;
  font-weight: 700;
}

.message-row.parallel-direct .avatar::after {
  content: "\2744";
  position: absolute;
  right: 0;
  bottom: 0;
  z-index: 1;
  width: 13px;
  height: 13px;
  border: 0;
  display: grid;
  place-items: center;
  color: #73d7ff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  text-shadow: 0 0 2px #effcff, 0 0 5px rgba(87, 204, 255, 0.95), 0 0 9px rgba(64, 174, 255, 0.72);
  transform-origin: center;
  animation: parallel-direct-breathe 2.4s ease-in-out infinite;
}

@keyframes parallel-direct-breathe {
  0%, 100% {
    opacity: 0.62;
    transform: scale(0.88);
    text-shadow: 0 0 2px #effcff, 0 0 4px rgba(87, 204, 255, 0.72);
  }
  50% {
    opacity: 1;
    transform: scale(1.08);
    text-shadow: 0 0 3px #ffffff, 0 0 7px rgba(105, 220, 255, 1), 0 0 11px rgba(52, 167, 255, 0.9);
  }
}

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

.partner-name {
  font-size: 17px;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.partner-status {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.provider-select {
  max-width: 190px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  padding: 7px 10px;
}

.message-list {
  position: relative;
  z-index: 1;
  overflow-y: auto;
  padding: 8px 10px 10px;
  touch-action: pan-y;
  overscroll-behavior: contain;
  user-select: none !important;
  -webkit-user-select: none !important;
  -webkit-touch-callout: none !important;
  background: transparent;
}

.chat-background-layer {
  position: absolute;
  top: 44px;
  left: 0;
  right: 0;
  height: var(--chat-background-height, calc(100% - 44px));
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  background:
    linear-gradient(rgba(219, 225, 219, 0.9), rgba(219, 225, 219, 0.9)),
    repeating-linear-gradient(135deg, transparent 0 12px, rgba(255, 255, 255, 0.2) 12px 13px);
}

.chat-background-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  opacity: var(--chat-background-opacity, 0.34);
  transition: opacity 0.12s ease;
}

.composer {
  position: relative;
  z-index: 2;
}

.empty-state {
  max-width: 520px;
  margin: 12vh auto 0;
  color: var(--muted);
  text-align: center;
  line-height: 1.8;
}

.message-row {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin: 6px 0;
  touch-action: pan-y;
  user-select: none !important;
  -webkit-user-select: none !important;
  -webkit-touch-callout: none !important;
}

.message-row.user {
  justify-content: flex-end;
}

.message-row.message-part {
  margin-bottom: 3px;
}

.message-row.message-part.split-continuation {
  margin-top: 3px;
}

.message-row.split-reveal {
  opacity: 0;
  max-height: 0;
  margin-top: 0;
  margin-bottom: 0;
  overflow: hidden;
  transform: translateY(3px);
  animation: split-bubble-reveal 200ms ease-out forwards;
  animation-delay: var(--bubble-reveal-delay, 0ms);
}

@keyframes split-bubble-reveal {
  to {
    opacity: 1;
    max-height: 420px;
    margin-top: 3px;
    margin-bottom: 3px;
    transform: translateY(0);
  }
}

.message-row.typing {
  margin-top: 8px;
}

.message-row.user .avatar {
  order: 2;
  background: linear-gradient(135deg, #b37272, #e3a088);
}

.bubble {
  max-width: min(70%, 640px);
  padding: 8px 10px;
  border-radius: 7px;
  background: var(--assistant-bubble);
  font-size: 15px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  position: relative;
  touch-action: pan-y;
  user-select: none !important;
  -webkit-user-select: none !important;
  -webkit-touch-callout: none !important;
  -webkit-user-drag: none;
}

.bubble *,
.message-row img {
  user-select: none !important;
  -webkit-user-select: none !important;
  -webkit-touch-callout: none !important;
  -webkit-user-drag: none;
}

.message-text {
  display: inline;
  pointer-events: none;
  user-select: none !important;
  -webkit-user-select: none !important;
  -webkit-touch-callout: none !important;
}

.message-text::before {
  content: attr(data-text);
  white-space: pre-wrap;
}

.message-row.user .bubble {
  background: var(--user-bubble);
}

.message-image {
  display: block;
  width: min(240px, 100%);
  max-height: 300px;
  margin-bottom: 7px;
  border-radius: 8px;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.5);
}

.message-image:only-child {
  margin-bottom: 0;
}

img.message-image {
  cursor: zoom-in;
  -webkit-touch-callout: default !important;
}

.message-image-viewer {
  width: min(960px, 96vw);
  max-width: 96vw;
  max-height: 94vh;
  max-height: 94dvh;
  padding: 0;
  border: 0;
  border-radius: 14px;
  color: #edf2f0;
  background: #202925;
  overscroll-behavior: contain;
}

.message-image-viewer::backdrop {
  background: rgba(0, 0, 0, 0.78);
}

.image-viewer-card { padding: 12px; }
.image-viewer-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.image-viewer-actions a,
.image-viewer-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 8px 14px;
  border: 1px solid #758d7f;
  border-radius: 9px;
  color: #fff;
  background: #354a3e;
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}
#messageImageFull {
  display: block;
  width: 100%;
  max-height: 72vh;
  max-height: 72dvh;
  object-fit: contain;
  -webkit-touch-callout: default !important;
  user-select: auto !important;
  touch-action: pinch-zoom;
}
.image-viewer-card p {
  margin: 10px 0 0;
  font-size: 13px;
  color: #d0dcd5;
}

.bubble-display-control {
  margin-top: 4px;
}

.generated-message-image.loading {
  aspect-ratio: 1;
  background:
    linear-gradient(100deg, rgba(255, 255, 255, 0.35) 25%, rgba(255, 255, 255, 0.75) 45%, rgba(255, 255, 255, 0.35) 65%),
    rgba(216, 225, 222, 0.8);
  background-size: 220% 100%;
  animation: image-loading-shimmer 1.2s linear infinite;
}

@keyframes image-loading-shimmer {
  to { background-position: -120% 0; }
}

.typing-bubble {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 76px;
  height: 38px;
  max-width: none;
  padding: 0 14px;
  user-select: none;
  -webkit-user-select: none;
}

.typing-dots {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-direction: row;
  gap: 5px;
  width: 34px;
  height: 10px;
}

.typing-dots i {
  display: block;
  flex: 0 0 6px;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: rgba(31, 38, 34, 0.46);
  animation: typingPulse 1.15s ease-in-out infinite;
}

.typing-dots i:nth-child(2) {
  animation-delay: 0.16s;
}

.typing-dots i:nth-child(3) {
  animation-delay: 0.32s;
}

@keyframes typingPulse {
  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.38;
  }

  40% {
    transform: translateY(-3px);
    opacity: 0.9;
  }
}

.time-divider {
  width: fit-content;
  max-width: 82%;
  margin: 9px auto 6px;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(100, 110, 104, 0.26);
  color: rgba(31, 38, 34, 0.72);
  font-size: 12px;
  line-height: 1.5;
}

.history-loader {
  display: block;
  width: fit-content;
  max-width: 82%;
  margin: 2px auto 14px;
  padding: 4px 9px;
  border: 0;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.44);
  color: rgba(31, 38, 34, 0.58);
  cursor: pointer;
  font-size: 12px;
  line-height: 1.5;
}

.meta {
  margin-top: 4px;
  color: rgba(31, 38, 34, 0.55);
  font-size: 11px;
}

.composer {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 4px 8px calc(4px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: #f4f4f1;
}

.composer-main {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 32px auto;
  align-items: end;
  gap: 6px;
  width: 100%;
}

.composer-main textarea {
  min-height: 34px;
  max-height: 96px;
  resize: none;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 6px 9px;
  outline: none;
  background: var(--white);
}

.send-button,
.composer-tool,
.primary-wide,
.secondary-wide,
.danger-wide,
.password-card button {
  border: 0;
  border-radius: 8px;
  padding: 0 18px;
  background: var(--wechat-deep);
  color: white;
  cursor: pointer;
  font-weight: 700;
}

.composer-tool {
  width: 32px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--text);
  font-size: 19px;
  line-height: 1;
}

.composer-mode-toggle {
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  display: grid;
  place-items: center;
}

.input-mode-icon {
  position: relative;
  display: grid;
  width: 28px;
  height: 28px;
  border: 1.6px solid #363636;
  border-radius: 50%;
  color: #363636;
}

.input-mode-speaker,
.input-mode-keyboard {
  position: absolute;
  inset: 0;
}

.input-mode-speaker {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.speaker-cone {
  fill: currentColor;
}

.speaker-arc {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.55px;
  stroke-linecap: round;
}

.input-mode-keyboard {
  display: none;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.keyboard-key {
  fill: currentColor;
}

.composer-mode-toggle.is-voice-input .input-mode-speaker {
  display: none;
}

.composer-mode-toggle.is-voice-input .input-mode-keyboard {
  display: block;
}

#imageButton {
  font-size: 24px;
  font-weight: 400;
}

.hold-to-talk {
  display: none;
  min-width: 0;
  width: 100%;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--white);
  color: var(--text);
  cursor: pointer;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  touch-action: none;
}

.composer.voice-mode .composer-main {
  grid-template-columns: 34px minmax(0, 1fr) 32px;
}

.composer.voice-mode textarea,
.composer.voice-mode .send-button {
  display: none;
}

.composer.voice-mode .hold-to-talk {
  display: block;
}

.hold-to-talk.recording {
  border-color: #b84a4a;
  background: #fff3f1;
  color: #b84a4a;
}

.hold-to-talk.transcribing {
  opacity: 0.62;
  cursor: wait;
}

.send-button {
  height: 34px;
  min-width: 50px;
  padding: 0 10px;
  font-size: 14px;
  align-self: end;
  touch-action: none;
  user-select: none;
  transition: background-color 160ms ease, transform 120ms ease;
}

.send-button.is-parallel-direct {
  background: #7651b5;
}

.send-button.is-mode-pressing {
  transform: scale(0.97);
}

.send-button:disabled {
  opacity: 0.55;
  cursor: default;
}

.hidden-file-input {
  display: none;
}

.image-preview {
  display: flex;
  align-items: center;
  gap: 9px;
  width: fit-content;
  max-width: 100%;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
}

.voice-mode-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 24px;
  padding: 1px 1px 0;
  color: var(--muted);
  font-size: 12px;
}

.voice-mode-picker { position: relative; min-width: 0; }
.voice-mode-trigger {
  display: flex; align-items: center; gap: 5px; max-width: 100%; min-height: 24px;
  padding: 0; border: 0; background: transparent; color: inherit; font: inherit;
  cursor: pointer; text-align: left;
}
#voiceModeHint { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.voice-mode-caret { font-size: 10px; flex: none; }
.voice-mode-menu {
  position: absolute; bottom: calc(100% + 6px); left: 0; z-index: 5;
  width: 180px; max-width: calc(100vw - 36px); padding: 4px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--white);
  box-shadow: 0 4px 18px rgba(31, 38, 34, .16);
}
.voice-mode-menu[hidden] { display: none; }
.voice-mode-menu button {
  display: block; width: 100%; min-height: 40px; border: 0; border-radius: 5px;
  padding: 8px 12px; background: transparent; color: var(--text); font: inherit;
  text-align: left; cursor: pointer;
}
.voice-mode-menu button[aria-checked="true"] { background: #eef6e9; color: var(--wechat-deep); }
.voice-mode-menu button[aria-checked="true"]::after { content: '✓'; float: right; }
.voice-mode-menu button:disabled { color: var(--muted); opacity: .55; cursor: default; }
.voice-mode-menu button:focus-visible, .voice-mode-trigger:focus-visible { outline: 2px solid var(--wechat-deep); outline-offset: 1px; }
.voice-lock-button { flex: none; }

.life-chat-status {
  min-height: 20px;
  padding: 2px 2px 0;
  color: #536b62;
  font-size: 12px;
  line-height: 1.4;
}

.voice-lock-button {
  min-width: 48px;
  min-height: 24px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--white);
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
}

.voice-lock-button:disabled {
  opacity: 0.55;
  cursor: default;
}

.voice-record-overlay {
  position: fixed;
  z-index: 80;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 18px;
  padding: max(24px, env(safe-area-inset-top)) 22px calc(34px + env(safe-area-inset-bottom));
  background: rgba(18, 24, 22, 0.68);
  color: white;
  pointer-events: none;
}

.voice-record-overlay.hidden {
  display: none;
}

.voice-record-timer {
  position: absolute;
  top: max(20px, env(safe-area-inset-top));
  left: 22px;
  min-width: 62px;
  padding: 7px 10px;
  border-radius: 8px;
  background: #dc4f45;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  text-align: center;
}

.voice-record-bubble {
  display: grid;
  place-items: center;
  width: min(86vw, 420px);
  height: 112px;
  border-radius: 18px 18px 8px 18px;
  background: #8de85c;
  color: #256a32;
  transition: background 120ms ease, transform 120ms ease;
}

.record-wave,
.audio-wave {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  min-width: 44px;
  height: 24px;
}

.record-wave i,
.audio-wave i {
  display: block;
  width: 3px;
  border-radius: 2px;
  background: currentColor;
}

.record-wave i:nth-child(1),
.audio-wave i:nth-child(1) { height: 7px; }
.record-wave i:nth-child(2),
.audio-wave i:nth-child(2) { height: 15px; }
.record-wave i:nth-child(3),
.audio-wave i:nth-child(3) { height: 22px; }
.record-wave i:nth-child(4),
.audio-wave i:nth-child(4) { height: 12px; }
.record-wave i:nth-child(5),
.audio-wave i:nth-child(5) { height: 8px; }

.voice-record-status {
  min-height: 24px;
  font-size: 17px;
  font-weight: 700;
}

.voice-record-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  width: min(92vw, 520px);
  color: rgba(255, 255, 255, 0.88);
  font-size: 15px;
  font-weight: 700;
}

.voice-record-actions span:first-child { text-align: left; }
.voice-record-actions span:last-child { text-align: right; }

.voice-record-overlay.is-cancel .voice-record-bubble {
  align-self: flex-start;
  width: 120px;
  height: 88px;
  background: #ff6159;
  color: #731e1c;
  transform: translateX(-18vw);
}

.voice-record-overlay.is-transcribe .voice-record-bubble {
  align-self: flex-end;
  background: #8de85c;
  transform: translateX(12vw);
}

.image-preview.hidden {
  display: none;
}

.image-preview img {
  width: 54px;
  height: 54px;
  border-radius: 7px;
  object-fit: cover;
}

.image-preview span {
  max-width: min(58vw, 260px);
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-preview button {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 999px;
  background: #e4e4df;
  color: var(--text);
  cursor: pointer;
}

.drawer {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  border-radius: 8px;
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.drawer-title {
  font-size: 18px;
  font-weight: 800;
}

.drawer-subtitle {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  padding: 10px;
  gap: 8px;
  border-bottom: 1px solid var(--line);
}

.tab {
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  padding: 9px 6px;
  cursor: pointer;
}

.tab.active {
  border-color: var(--line);
  background: var(--white);
  font-weight: 700;
}

.tab-panel {
  display: none;
  min-height: 0;
  overflow: visible;
  padding: 16px;
}

.tab-panel.active {
  display: block;
}

.drawer-scroll { min-height:0; overflow-y:auto; overscroll-behavior:contain; }
.drawer-account-actions { padding:0 16px 16px; }
.family-member-list { display:grid; gap:6px; }
.family-member-head,.family-member-row { display:grid; grid-template-columns:minmax(56px,.75fr) minmax(72px,.85fr) minmax(0,1.5fr) 30px; gap:5px; align-items:start; }
.family-member-head { padding:0 8px; margin-bottom:5px; color:var(--muted); font-size:12px; }
.family-member-row { padding:4px 7px; border:1px solid var(--line); border-radius:6px; background:var(--white); }
.family-member-row > * { min-width:0; }
.family-member-row input,.family-member-row select,.family-member-row textarea { min-width:0; width:100%; height:40px; min-height:40px; margin:0; padding:7px 5px; font-size:13px; box-sizing:border-box; }
.family-member-row textarea { resize:vertical; padding:9px 5px; line-height:20px; }
.family-member-row textarea:focus { height:84px; }
.family-member-row .mini-icon-button { width:30px; height:40px; margin:0; }
.family-member-relation { position:relative; }
.family-member-relation.has-custom select { color:transparent; appearance:none; -webkit-appearance:none; }
.family-member-relation.has-custom::after { content:'▾'; position:absolute; right:5px; top:9px; color:var(--text); font-size:12px; line-height:20px; pointer-events:none; }
.family-member-relation select option { color:var(--text); }
.family-member-custom { position:absolute; top:0; left:0; max-width:calc(100% - 20px); }
.family-member-custom[hidden] { display:none; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

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

label,
.field-block {
  color: var(--muted);
  font-size: 13px;
}

.field-block {
  display: block;
  margin-top: 14px;
}

.tts-volume-control {
  display: block;
  margin: 12px 0;
}

.tts-volume-control > span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.tts-volume-control output {
  min-width: 38px;
  color: var(--wechat-deep);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.tts-volume-control input[type="range"] {
  height: 28px;
  margin-top: 4px;
  padding: 0;
  border: 0;
  accent-color: var(--wechat-deep);
}

input,
textarea,
select {
  width: 100%;
  margin-top: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  color: var(--text);
  padding: 9px 10px;
  outline: none;
}

input::placeholder,
textarea::placeholder {
  color: rgba(106, 116, 110, 0.58);
}

textarea {
  resize: vertical;
  line-height: 1.55;
}

.anniversary-list {
  display: grid;
  gap: 10px;
}

.anniversary-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px 34px;
  gap: 8px;
  align-items: end;
}

.anniversary-row label {
  min-width: 0;
}

.mini-icon-button {
  width: 34px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  color: var(--muted);
  cursor: pointer;
}

.background-preview {
  width: 100%;
  min-height: 92px;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(rgba(219, 225, 219, 0.72), rgba(219, 225, 219, 0.72)),
    repeating-linear-gradient(135deg, transparent 0 12px, rgba(255, 255, 255, 0.36) 12px 13px);
  background-position: center;
  background-size: cover;
  overflow: hidden;
}

.background-preview.has-image {
  min-height: 132px;
}

.background-opacity-control {
  display: grid;
  gap: 8px;
  margin: 12px 0;
  color: var(--muted);
}

.background-opacity-control span {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.background-opacity-control output {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.background-opacity-control input {
  width: 100%;
}

.avatar-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.avatar-picker {
  display: block;
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.55);
}

.toggle-line {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0;
  color: var(--text);
}

.toggle-line input {
  width: 18px;
  height: 18px;
  margin: 0;
}

.settings-block {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.life-settings-block .toggle-line {
  margin: 9px 0 0;
}

.life-settings-block .status-panel {
  margin-top: 10px;
}

.pending-preference-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.empty-inline {
  color: var(--muted);
  font-size: 13px;
  padding: 8px 0;
}

.pending-preference-item {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.58);
}

.pending-preference-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
}

.pending-preference-type,
.pending-preference-category {
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(113, 129, 117, 0.12);
  color: var(--muted);
  font-size: 12px;
}

.pending-preference-type.like {
  background: rgba(82, 132, 93, 0.14);
  color: #446f4b;
}

.pending-preference-type.dislike {
  background: rgba(148, 88, 78, 0.14);
  color: #894f47;
}

.pending-preference-text {
  min-width: 0;
  font-weight: 650;
}

.pending-preference-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.pending-preference-actions button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  color: var(--text);
}

.settings-block .toggle-line {
  margin-top: 0;
}

.inline-number-field {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
  font-weight: 800;
}

.inline-number-field input {
  flex: 0 0 88px;
  width: 88px;
  text-align: center;
}

.section-title {
  margin-bottom: 10px;
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
}

.hint-text {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.readable-counter {
  margin-top: 6px;
}

.primary-wide,
.secondary-wide,
.danger-wide {
  width: 100%;
  min-height: 42px;
  margin-top: 14px;
}

.secondary-wide {
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--text);
}

.danger-wide {
  background: var(--danger);
}

.status-panel {
  margin-top: 14px;
  padding: 12px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--muted);
  line-height: 1.7;
  font-size: 13px;
}

.owner-only.hidden {
  display: none !important;
}

.admin-user-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.admin-user-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
}

.admin-user-name {
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
}

.admin-user-meta {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.mini-button {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  padding: 0 12px;
  cursor: pointer;
}

.voice-upload {
  margin-top: 14px;
}

.speak-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 16px;
  margin-left: 5px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: rgba(31, 38, 34, 0.45);
  vertical-align: -1px;
  cursor: pointer;
}

.speak-bars {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 14px;
}

.speak-bars i {
  display: block;
  width: 2px;
  border-radius: 999px;
  background: currentColor;
}

.speak-bars i:nth-child(1) {
  height: 7px;
}

.speak-bars i:nth-child(2) {
  height: 13px;
}

.speak-bars i:nth-child(3) {
  height: 9px;
}

.speak-button.playing {
  color: var(--wechat-deep);
}

.speak-button.cached-speech-button {
  color: #67b7d2;
}

.speak-button.cached-speech-button.playing {
  color: #4099ba;
}

.speak-button.playing .speak-bars i {
  animation: speakWave 0.72s ease-in-out infinite;
}

.speak-button.playing .speak-bars i:nth-child(2) {
  animation-delay: 0.12s;
}

.speak-button.playing .speak-bars i:nth-child(3) {
  animation-delay: 0.24s;
}

@keyframes speakWave {
  0%,
  100% {
    transform: scaleY(0.55);
    opacity: 0.45;
  }

  45% {
    transform: scaleY(1.25);
    opacity: 1;
  }
}

.speak-button.loading {
  opacity: 0.6;
  cursor: default;
}

.voice-only-bubble {
  min-width: 108px;
  padding: 8px 10px;
}

.voice-message-bubble {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  line-height: 1;
}

.voice-message-bubble {
  min-width: 88px;
  justify-content: flex-end;
  padding: 3px 1px;
}

.voice-message-bubble .audio-wave {
  min-width: 34px;
  height: 19px;
  gap: 2px;
  color: #424a46;
  transform: rotate(180deg);
}

.voice-message-bubble .audio-wave i {
  width: 2px;
}

.voice-message-bubble .audio-wave i:nth-child(1) { height: 5px; }
.voice-message-bubble .audio-wave i:nth-child(2) { height: 11px; }
.voice-message-bubble .audio-wave i:nth-child(3) { height: 17px; }
.voice-message-bubble .audio-wave i:nth-child(4) { height: 9px; }
.voice-message-bubble .audio-wave i:nth-child(5) { height: 6px; }

.voice-message-bubble.playing .audio-wave i {
  animation: speakWave 0.72s ease-in-out infinite;
}

.voice-message-bubble.playing .audio-wave i:nth-child(2) {
  animation-delay: 0.12s;
}

.voice-message-bubble.playing .audio-wave i:nth-child(3) {
  animation-delay: 0.24s;
}

.voice-message-bubble.playing .audio-wave i:nth-child(4) {
  animation-delay: 0.36s;
}

.voice-message-bubble.loading {
  opacity: 0.58;
  cursor: default;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%) translateY(20px);
  max-width: min(90vw, 520px);
  border-radius: 8px;
  background: rgba(31, 38, 34, 0.9);
  color: white;
  padding: 10px 14px;
  opacity: 0;
  pointer-events: none;
  transition: 0.2s ease;
  z-index: 20;
}

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

.message-action-menu {
  position: fixed;
  z-index: 25;
  display: flex;
  align-items: center;
  min-width: 0;
  padding: 3px 6px;
  border: 1px solid rgba(28, 37, 32, 0.14);
  border-radius: 7px;
  background: rgba(31, 38, 34, 0.94);
  box-shadow: 0 10px 24px rgba(35, 43, 37, 0.24);
}

.message-action-menu.hidden {
  display: none;
}

.message-action-menu button {
  min-width: 46px;
  min-height: 30px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #fff;
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
}

.message-action-menu button + button {
  border-left: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 0;
}

.message-action-menu button:hover {
  background: rgba(255, 255, 255, 0.12);
}

.avatar-crop-mask {
  position: fixed;
  inset: 0;
  z-index: 35;
  display: grid;
  place-items: center;
  padding: 18px;
  width:100vw;
  max-width:none;
  height:100dvh;
  max-height:none;
  margin:0;
  border:0;
  overflow:auto;
  background:transparent;
  color:var(--text);
}
.avatar-crop-mask::backdrop { background:rgba(20,25,22,.48); }
.avatar-crop-mask:not([open]) { display:none; }

.avatar-crop-mask.hidden {
  display: none;
}

.avatar-crop-card {
  width: min(100%, 390px);
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.avatar-crop-title {
  margin-bottom: 12px;
  font-size: 17px;
  font-weight: 800;
  text-align: center;
}

#avatarCropCanvas {
  display: block;
  width: min(74vw, 320px);
  max-width: 100%;
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  border-radius: 8px;
  background: #eef0ec;
  touch-action: none;
}

#avatarCropZoom {
  margin-top: 14px;
}

.avatar-crop-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.avatar-crop-actions button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
}

.avatar-crop-actions button:last-child {
  border: 0;
  background: var(--wechat-deep);
  color: #fff;
}

.password-mask {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: max(22px, env(safe-area-inset-top)) 18px max(30px, env(safe-area-inset-bottom));
  overflow: hidden;
  background: #f4f4f1 url("/assets/login-lishen-full.jpg?v=20260626-login-fullscreen") center center / cover no-repeat;
  z-index: 30;
}

.password-mask::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(246, 247, 244, 0.24) 48%, rgba(246, 247, 244, 0.78));
  pointer-events: none;
}

.password-mask.hidden {
  display: none;
}

html.has-saved-password .password-mask {
  display: none;
}

body.auth-locked .phone-shell {
  visibility: visible;
  pointer-events: none;
}

body.auth-locked .message-list {
  background: rgba(223, 228, 223, 0.52);
}

.password-card {
  position: relative;
  z-index: 1;
  width: min(92vw, 360px);
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 18px 50px rgba(28, 35, 30, 0.18);
  backdrop-filter: blur(14px);
}

.password-card h1 {
  margin: 0 0 8px;
  font-size: 20px;
}

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

.password-card input {
  width: 100%;
  height: 42px;
  margin-top: 10px;
}

.password-card button {
  width: 100%;
  height: 42px;
  margin-top: 12px;
}

@media (max-width: 860px) {
  .phone-shell {
    display: block;
    width: 100vw;
    height: auto;
    position: fixed;
    inset: 0 0 var(--keyboard-offset, 0px) 0;
    padding: 0;
    transform: translateZ(0);
  }

  .chat-screen {
    height: 100%;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .drawer {
    position: fixed;
    inset: 0;
    z-index: 10;
    border-radius: 0;
    transform: translateX(100%);
    transition: transform 0.2s ease;
  }

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

  .provider-select {
    max-width: 132px;
  }

  .message-list {
    padding: 7px 9px 9px;
  }

  .bubble {
    max-width: 68vw;
  }

  .anniversary-row {
    grid-template-columns: minmax(0, 1fr) 136px 34px;
  }

}
/* A compact control strip inside the existing chat composer. */
.bedtime-bar { display:flex; align-items:center; gap:8px; padding:6px 0; font-size:13px; color:#66756b; }
.bedtime-bar[hidden] { display:none; }
.bedtime-bar span { flex:1; min-width:0; }
.bedtime-bar button { flex:none; padding:5px 9px; border:1px solid #d4ddd5; border-radius:8px; background:#fff; color:inherit; }
.story-source { display:block; font-size:12px; color:#748078; margin-bottom:8px; }
.billing-notice { position:relative; z-index:1; margin:4px 12px; padding:8px 10px; font-size:13px; color:#3c5148; background:#fff; }
.billing-notice[hidden] { display:none; }
.password-card .password-visibility,.account-security-dialog .password-visibility { display:flex; align-items:center; gap:8px; margin:8px 0; font-size:13px; }
.password-card .password-visibility input,.account-security-dialog .password-visibility input { width:auto; margin:0; padding:0; }
.admin-user-actions { display:grid; gap:6px; }
.password-card .password-help { background:transparent; color:var(--wechat-deep); border:0; padding:10px; }
.login-status { color:#a52d27; font-size:13px; line-height:1.5; white-space:pre-wrap; }
.login-status:empty { display:none; }
.account-security-dialog { width:min(92vw,440px); max-height:90dvh; padding:0; border:1px solid var(--line); border-radius:12px; color:var(--text); background:var(--white); }
.account-security-dialog::backdrop { background:rgba(0,0,0,.4); }
.security-dialog-content { padding:20px; overflow-y:auto; max-height:88dvh; }
.security-dialog-header { display:flex; justify-content:space-between; align-items:center; gap:12px; }
.security-dialog-header h2 { margin:0 0 12px; font-size:20px; }
.account-security-dialog label { display:block; margin:12px 0; }
.account-security-dialog input,.account-security-dialog textarea { width:100%; box-sizing:border-box; padding:10px; margin-top:6px; border:1px solid var(--line); border-radius:6px; font:inherit; }
.account-security-dialog button { padding:10px 14px; margin:5px 4px 5px 0; border:1px solid var(--line); border-radius:6px; background:var(--white); color:var(--text); font:inherit; }
.account-security-dialog button[type=submit] { background:var(--wechat-deep); color:#fff; }
.account-security-dialog p,.account-security-dialog [role=status] { font-size:13px; line-height:1.6; white-space:pre-wrap; }
#recoveryCodeBox[hidden] { display:none; }
#createConversationDialog { overflow:hidden; }
#createConversationDialog .conversation-dialog-shell { display:flex; flex-direction:column; max-height:calc(90dvh - 2px); min-height:0; }
#createConversationDialog .security-dialog-header { flex:none; padding:12px 16px; border-bottom:1px solid var(--line); background:var(--white); }
#createConversationDialog .security-dialog-header h2 { margin:0; }
#createConversationDialog #closeCreateConversation { flex:none; width:36px; height:36px; padding:4px; margin:0; font-size:25px; line-height:1; }
#conversationSettingsScroll { min-height:0; max-height:none; overflow-y:auto; overscroll-behavior:contain; padding:8px 16px 18px; }
#createConversationDialog .conversation-member-pick { padding:0; }
#createConversationDialog .conversation-member-pick>summary { display:flex; align-items:center; gap:8px; min-height:52px; padding:8px 0; list-style:none; cursor:pointer; }
#createConversationDialog .conversation-member-pick>summary::-webkit-details-marker { display:none; }
#createConversationDialog .member-choice { flex:none; margin:0; display:flex; align-items:center; }
#createConversationDialog .member-choice input { width:18px; height:18px; margin:0; }
.member-summary-names { flex:1; min-width:0; display:flex; align-items:baseline; gap:6px; }
.member-summary-names strong { min-width:0; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; font-size:14px; font-weight:500; }
.member-summary-names small { flex:none; color:var(--muted); font-size:12px; }
.member-disclosure { flex:none; color:var(--muted); font-size:20px; transition:transform .15s; }
.conversation-member-pick[open]>summary .member-disclosure { transform:rotate(180deg); }
.member-mini-avatar { width:30px; height:30px; border-radius:5px; font-size:15px; background:#c08e86; }
.member-avatar-preview { width:52px; height:52px; font-size:24px; background:#c08e86; }
#createConversationDialog .member-settings-fields { padding:4px 0 14px 26px; gap:10px; }
#createConversationDialog .member-settings-fields label { display:grid; margin:0; gap:4px; font-size:13px; }
#createConversationDialog .member-settings-fields input:not([type=file]),#createConversationDialog .member-settings-fields textarea,#createConversationDialog .member-settings-fields select { width:100%; min-width:0; margin:0; padding:8px; font-size:13px; }
.member-avatar-editor { display:flex; align-items:center; gap:10px; min-width:0; }
.member-avatar-actions { display:flex; flex-wrap:wrap; gap:6px; min-width:0; }
#createConversationDialog .member-avatar-actions button,#createConversationDialog .member-growth-button { margin:0; padding:7px 9px; font-size:12px; }
#createConversationDialog button:disabled { opacity:.45; }
.member-selection-hint { display:block; margin:0 0 8px 26px; color:var(--muted); font-size:12px; }
#recoveryCodeValue { font-family:ui-monospace,monospace; font-size:14px; }

/* One disclosure pattern throughout settings, matching the member rows. */
.settings-fold { border:1px solid var(--line); border-radius:12px; margin:16px 0; padding:0 14px; background:rgba(255,255,255,.48); }
.settings-fold>summary { display:flex; align-items:center; justify-content:space-between; gap:12px; min-height:52px; padding:12px 0; margin:0; list-style:none; cursor:pointer; font-size:16px; font-weight:600; }
.settings-fold>summary::marker { content:''; }
.settings-fold>summary::-webkit-details-marker { display:none; }
.settings-fold>summary::after { content:'⌄'; color:var(--muted); font-size:20px; line-height:1; flex:none; transition:transform .15s; }
.settings-fold[open]>summary::after { transform:rotate(180deg); }
.settings-fold[open] { padding-bottom:14px; }
.settings-fold .settings-fold { background:transparent; }
#lifeArrangementSummary { display:block; margin:4px 0 0; font-size:12px; font-weight:400; color:var(--muted); }
.memory-digest-note { margin:6px 0 18px; }
.notification-invite { display:flex; align-items:center; gap:8px; padding:10px 14px; border-bottom:1px solid var(--line); font-size:13px; color:var(--muted); }
.notification-invite[hidden] { display:none; }
.notification-invite span { flex:1; }
.notification-invite button { border:0; border-radius:8px; padding:6px 8px; background:transparent; color:var(--green); }
#conversationForm[hidden],#chatHistoryExportSection[hidden] { display:none; }

.drawer [data-settings-scope][hidden],.drawer .tab[hidden],.drawer .tab-panel[hidden],.drawer-account-actions[hidden],#chatPreferenceTools[hidden] { display:none!important; }
.settings-context-line { color:var(--muted); font-size:12px; margin:0 0 16px; }
#groupChatPreferences #chatPreferenceTools { margin-top:20px; padding-top:14px; border-top:1px solid var(--line); }
#chatPreferenceTools .settings-block { margin-top:20px; }
.drawer[data-context=private] #settingsAccountInfo { line-height:1.5; }

/* Keep the home navigation outside the scrolling pages. */
.conversation-home {
  font-family: -apple-system, BlinkMacSystemFont, "Microsoft YaHei", system-ui, sans-serif;
}
.conversation-home-header { display:grid; grid-template-columns:40px 1fr 40px; text-align:center; background:#ededed; }
.home-pane { flex:1; min-height:0; display:flex; flex-direction:column; overflow:auto; }
.home-pane[hidden],.conversation-home [hidden],.drawer [data-primary-only][hidden] { display:none!important; }
.home-settings-pane { background:#ededed; }
.home-bottom-nav {
  flex:none;
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  min-height:58px;
  padding-bottom:env(safe-area-inset-bottom,0px);
  border-top:1px solid #dedede;
  background:#f7f7f7;
}
.home-bottom-nav button {
  display:flex;
  align-items:center;
  justify-content:center;
  flex-direction:column;
  gap:3px;
  border:0;
  border-radius:0;
  background:transparent;
  color:#151515;
  font:inherit;
  font-size:12px;
}
.home-bottom-nav button[aria-current] { color:#008c45; }
.home-bottom-nav svg { width:26px; height:26px; fill:none; stroke:currentColor; stroke-width:1.7; stroke-linecap:round; stroke-linejoin:round; }
.home-bottom-nav [data-home-tab=chat][aria-current] svg path:first-child { fill:currentColor; }
.home-bottom-nav [data-home-tab=chat][aria-current] svg path:last-child { stroke:#fff; }
.home-profile-row,.home-me-menu button {
  display:flex;
  align-items:center;
  gap:14px;
  width:100%;
  min-height:54px;
  padding:12px 18px;
  text-align:left;
  color:#151515;
  background:#fff;
  border:0;
  border-radius:0;
  font:inherit;
}
.home-profile-row { min-height:88px; }
.home-profile-row strong,.home-profile-row small { display:block; }
.home-profile-row small { margin-top:4px; color:#777; }
.home-me-menu { margin-top:9px; }
.home-me-menu button+button { border-top:1px solid #ededed; }
.row-chevron { margin-left:auto; font-size:22px; color:#808080; }
.friend-form { margin-top:9px; }
.friend-form > label {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  min-height:54px;
  padding:0 16px;
  background:#fff;
  color:#202020;
  border-bottom:1px solid #ededed;
  font-size:15px;
}
.friend-form > label > :is(input,select) {
  width:60%;
  margin:0;
  border:0;
  background:transparent;
  text-align:end;
  font:inherit;
}
.friend-form > label > textarea { width:100%; margin-top:8px; border:0; padding:6px 0; font:inherit; }
.friend-form > .primary-wide { display:block; width:calc(100% - 32px); margin:16px auto; }
#friendStatus { margin:0 16px; color:#8b2d29; font-size:13px; }
.drawer,.conversation-dialog-shell {
  font-family:-apple-system, BlinkMacSystemFont, "Microsoft YaHei", system-ui, sans-serif;
  background:#ededed;
}
.drawer-header,.drawer .tabs { background:#f7f7f7; }
.drawer .tabs { padding:0 8px; gap:0; }
.drawer .tab { min-height:45px; border:0; border-radius:0; border-bottom:2px solid transparent; }
.drawer .tab.active { color:#008c45; background:transparent; border-bottom-color:currentColor; }
.drawer .tab-panel { padding:10px 0 18px; }
.drawer .settings-fold,.conversation-dialog-shell .settings-fold {
  border:0;
  border-bottom:1px solid #ededed;
  border-radius:0;
  margin:0;
  padding:0 16px;
  background:#fff;
}
.drawer .settings-fold>summary,.conversation-dialog-shell .settings-fold>summary { min-height:52px; font-size:15px; font-weight:500; }
.drawer .settings-fold[open],.conversation-dialog-shell .settings-fold[open] { padding-bottom:14px; }
.drawer #lifeArrangementSection { margin:0; border:0; border-bottom:1px solid #ededed; border-radius:0; padding:0 16px; }
.drawer #lifeArrangementSection[open] { padding-bottom:14px; }
.drawer #lifeArrangementSummary { display:inline; padding:0 0 0 10px; }
.drawer .tab-panel>.primary-wide { display:block; width:calc(100% - 32px); margin:14px auto 0; }
.drawer .tab-panel>.toggle-line,.drawer #tab-admin { padding-inline:16px; }
.drawer .settings-inline-fields { gap:0; }
.settings-inline-fields>label {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  min-height:44px;
  border-top:1px solid #ededed;
  color:var(--text);
}
.settings-inline-fields>label :is(input,select) { width:64%; margin:0; border:0; background:transparent; text-align:end; }
.drawer .memory-field textarea,.drawer #persona,.drawer #relationshipState,.drawer #userDescription { display:block; margin:0 0 8px; width:100%; }
.memory-counter,.settings-row-value { margin-left:auto; color:#686868; font-weight:400; white-space:nowrap; }
.drawer .life-settings-block .compact-grid { margin:3px 0 8px; }
.drawer #chatPreferenceTools>.toggle-line,.drawer .settings-context-line,.drawer #chatPreferenceTools>.field-block { margin-inline:16px; }
.drawer #chatPreferenceTools .settings-fold,.conversation-dialog-shell #chatPreferenceTools .settings-fold { margin-block:6px; }
.drawer .drawer-account-actions { background:#fff; padding-top:1px; }
#createConversationDialog #includePrimaryRow { display:flex; gap:8px; align-items:center; }
#createConversationDialog #includePrimaryRow[hidden] { display:none; }
#createConversationDialog #includePrimary { width:18px; height:18px; margin:0; }
.role-world-switch { min-height:44px; display:flex; align-items:center; justify-content:space-between; gap:12px; color:var(--text); font-size:15px; }
.role-world-switch input { width:20px; height:20px; margin:0; accent-color:#008c45; }
#parallelWorldRoleSection .hint-text { margin:0 0 10px; max-width:43ch; }
#parallelWorldRoleNotes { display:block; width:100%; }
.writing-tip { display:block; margin:0 0 6px; }
.friend-quick-setup { margin-top:9px; padding:0 0 12px; background:#fff; }
.friend-form .friend-notes-row { display:block; padding:12px 16px; }
.friend-source-options { border:0; margin:0; padding:14px 16px; display:flex; gap:24px; flex-wrap:wrap; }
.friend-source-options legend { padding-top:14px; font-size:15px; color:#202020; }
.friend-source-options label,.friend-game-row label { display:flex; align-items:center; gap:8px; font-size:14px; color:#202020; cursor:pointer; }
.friend-source-options input,.friend-game-row input { width:18px; height:18px; margin:0; accent-color:#008c45; flex:none; }
.friend-game-row { display:grid; grid-template-columns:minmax(0,1fr) minmax(115px,.85fr); align-items:center; gap:10px; min-height:54px; margin:0 16px; border-bottom:1px solid #ededed; }
.friend-game-row select { width:100%; margin:0; background:transparent; border:0; text-align:end; font:inherit; color:#333; }
#friendPresetTraits { margin:10px 16px 0; }
.friend-persona-preview { margin:12px 16px 0; padding-top:12px; border-top:1px solid #ededed; }
.friend-persona-preview summary { display:flex; justify-content:space-between; align-items:center; cursor:pointer; font-size:13px; color:#666; list-style:none; }
.friend-persona-preview summary::-webkit-details-marker { display:none; }
.friend-persona-preview summary::after { content:'⌄'; font-size:18px; }
.friend-persona-preview[open] summary::after { content:'⌃'; }
.friend-persona-preview p { margin:10px 0 0; font-size:13px; line-height:1.8; color:#555; }
.drawer-private-actions { padding:0 16px 20px; }
.drawer-private-actions .danger-wide { background:#fff; color:#b33b38; border:0; border-radius:8px; }
#friendTagsPane { padding:0 16px; }
#friendTagGroups fieldset { border:0; padding:0; margin:14px 0; min-width:0; }
#friendTagGroups legend { font-size:13px; color:#777; margin-bottom:8px; }
.friend-tag-list { display:flex; flex-wrap:wrap; gap:8px; }
.friend-tag-list button { border:1px solid #dedede; border-radius:20px; padding:8px 12px; background:#fafafa; color:#333; font-size:13px; }
.friend-tag-list button[aria-pressed=true] { border-color:#008c45; background:#ecf8ef; color:#00783d; }
.friend-tag-list button:disabled { opacity:.4; }
.friend-quick-setup .friend-relation-tip { margin:12px 16px 0; font-size:12px; }
.friend-tag-list button:focus-visible { outline:2px solid #008c45; outline-offset:2px; }
#parallelWorldRoleSection[hidden],#conversationWorldRow[hidden],#appointmentLaneRow[hidden] { display:none!important; }
/* Account wallet: compact rows, with the same disclosure control as settings. */
.wallet-menu-value{margin-left:auto;margin-right:10px;color:#777;font-size:.9em;font-weight:400}
.envelopes-dialog{width:min(94vw,490px);max-height:90dvh;padding:0;border:0;border-radius:12px;background:#f7f7f7}
.envelopes-dialog .security-dialog-content{padding:0 18px 20px;max-height:90dvh;overflow-y:auto}
.envelopes-dialog .security-dialog-header{position:sticky;top:0;z-index:2;background:#f7f7f7;padding:14px 0;border-bottom:1px solid #e5e5e5;margin-bottom:16px}
.envelopes-dialog .security-dialog-header h2{font-size:20px;margin:0}
.envelopes-dialog .security-dialog-header button{min-width:36px;min-height:36px;font-size:26px;background:transparent;border:0;color:#222}
.envelopes-dialog label{display:block;margin:12px 0;color:#444}
.envelopes-dialog input:not([type=checkbox]),.envelopes-dialog textarea{width:100%;box-sizing:border-box;margin-top:6px;min-width:0;padding:11px 10px;border:1px solid #e1e1e1;border-radius:7px;background:white;font:inherit}
.envelopes-dialog button{cursor:pointer}
.envelopes-dialog button:disabled{opacity:.55;cursor:default}
.envelope-balance{text-align:center;padding:16px 0 24px;display:flex;flex-direction:column;gap:6px}
.envelope-balance strong{font:500 44px/1.25 system-ui,sans-serif;color:#1d8a49}
.envelope-balance small{color:#777;line-height:1.6}
.envelope-redeem>div,.phone-code-row,.envelope-button-row{display:flex;align-items:center;gap:8px}
.envelope-redeem input,.phone-code-row input{flex:1;min-width:0}
.envelope-redeem button,.phone-code-row button,.envelope-button-row button{flex-shrink:0;border:0;border-radius:7px;padding:11px 14px;background:#18864b;color:white;font:inherit}
.envelope-section{margin:18px 0;padding:10px 0;border-top:1px solid #e5e5e5}
.envelope-section p{font-size:13px;line-height:1.8;color:#777}
.envelope-record{display:flex;justify-content:space-between;align-items:center;gap:14px;padding:13px 0;border-bottom:1px solid #e8e8e8}
.envelope-record>span:first-child{display:flex;flex-direction:column;gap:4px;overflow-wrap:anywhere}
.envelope-record small{font-size:12px;color:#888}
.envelope-record strong{white-space:nowrap;font-weight:500}
.envelope-record button{border:1px solid #ddd;border-radius:5px;background:#fff;padding:5px 9px;white-space:nowrap}
.envelopes-dialog [role=status]{font-size:13px;color:#666;margin:10px 0;line-height:1.6;overflow-wrap:anywhere}
.envelopes-dialog #registrationStatus.registration-error{color:#a52d27;background:#fff0ee;border:1px solid #e6b1aa;border-radius:6px;padding:10px}
.envelopes-dialog .toggle-line{display:flex;align-items:center;gap:10px}
.envelopes-dialog .toggle-line input{width:auto;margin:0}

.envelopes-dialog .registration-consent-row{display:flex;align-items:center;flex-wrap:wrap;gap:0 2px;margin:16px 0 8px}
.envelopes-dialog .registration-consent-row .toggle-line{margin:0}
.envelopes-dialog button.terms-link,.account-security-dialog button.terms-link{width:auto;padding:0;margin:0;border:0;background:transparent;color:#18864b;font:inherit;text-decoration:underline;box-shadow:none}
.envelopes-dialog .terms-body{white-space:pre-wrap;font-size:13px;line-height:1.75;color:#333;max-height:min(60dvh,480px);overflow-y:auto;background:#fff;border:1px solid #e1e1e1;border-radius:7px;padding:12px;margin:0 0 16px}
