:root {
  --bg: #f1f2f4;
  --panel: #ffffff;
  --ink: #171a20;
  --muted: #7a8392;
  --line: #e5e8ee;
  --green: #20b85a;
  --green-deep: #138940;
  --red: #e5484d;
  --blue: #2477e8;
  --amber: #f59b24;
  --shadow: 0 18px 48px rgba(24, 33, 48, .14);
}

* { box-sizing: border-box; }
html, body, #app { width: 100%; min-height: 100%; margin: 0; }
body {
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-tap-highlight-color: transparent;
}
button, input { font: inherit; }
button { border: 0; cursor: pointer; }
input { min-width: 0; border: 0; outline: 0; }
button, .no-select {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}
.hidden { display: none !important; }

.auth-view {
  min-height: var(--app-height, 100vh);
  height: var(--app-height, 100vh);
  display: grid;
  place-items: center;
  padding: 22px;
  background: linear-gradient(180deg, rgba(32, 184, 90, .12), transparent 44%), var(--bg);
}
.auth-panel {
  width: min(430px, 100%);
  display: grid;
  gap: 18px;
  padding: 26px 22px;
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark {
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  font-size: 25px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--green), var(--blue));
}
.brand h1 { margin: 0 0 5px; font-size: 25px; }
.brand p { margin: 0; color: var(--muted); line-height: 1.45; }
.auth-form { display: grid; gap: 12px; }
.auth-form label { display: grid; gap: 7px; color: var(--muted); font-size: 13px; }
.auth-form input, .search-bar input, .composer input {
  height: 44px;
  padding: 0 13px;
  border-radius: 6px;
  background: #f5f6f8;
  color: var(--ink);
}
.sms-code-row > span:last-child {
  display: grid;
  grid-template-columns: 1fr 112px;
  gap: 8px;
}
.sms-code-row button {
  height: 44px;
  border-radius: 6px;
  color: #fff;
  background: var(--blue);
  font-size: 13px;
  font-weight: 700;
}
.sms-code-row button:disabled {
  opacity: .65;
}
.primary {
  height: 44px;
  border-radius: 6px;
  color: #fff;
  font-weight: 700;
  background: var(--green);
}
.text-button { height: 36px; color: var(--green-deep); background: transparent; }
.inline-change {
  width: fit-content;
  height: 28px;
  padding: 0;
  font-size: 13px;
  text-align: left;
}
.status-line { min-height: 20px; color: var(--red); font-size: 13px; }

.shell {
  width: min(480px, 100%);
  min-height: var(--app-height, 100vh);
  height: var(--app-height, 100vh);
  margin: 0 auto;
  position: relative;
  overflow: hidden;
  background: var(--bg);
}
.topbar, .chat-head {
  height: calc(58px + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 14px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8f9fb;
  border-bottom: 1px solid var(--line);
}
.topbar { position: relative; justify-content: flex-end; }
.topbar-title { position: absolute; left: 50%; top: env(safe-area-inset-top); width: min(58%, 260px); height: 58px; display: grid; align-content: center; transform: translateX(-50%); text-align: center; pointer-events: none; }
.topbar-title strong { line-height: 24px; }
.topbar-title #socketState { position: absolute; left: 50%; bottom: 2px; margin: 0; transform: translateX(-50%); line-height: 14px; white-space: nowrap; }
.topbar strong, .chat-head strong { display: block; font-size: 19px; }
.topbar span, .chat-head span { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; }
.top-actions { position: relative; display: flex; gap: 6px; }
.top-sound-btn { position: absolute; left: 10px; top: calc(env(safe-area-inset-top) + 7px); width: 44px; height: 44px; }
.circle-plus-btn { width: 44px; height: 44px; color: #424a54; font-size: 36px; line-height: 1; }
.top-add-menu { position: absolute; z-index: 35; top: 42px; right: 0; width: 166px; overflow: hidden; border-radius: 6px; color: #fff; background: #31343a; box-shadow: 0 8px 22px rgba(0, 0, 0, .24); }
.top-add-menu::before { content: ''; position: absolute; top: -6px; right: 12px; width: 12px; height: 12px; transform: rotate(45deg); background: #31343a; }
.top-add-menu button { position: relative; width: 100%; min-height: 48px; display: grid; grid-template-columns: 28px 1fr; align-items: center; gap: 8px; padding: 0 14px; border-bottom: 1px solid rgba(255, 255, 255, .1); color: #fff; text-align: left; background: transparent; }
.top-add-menu button:last-child { border-bottom: 0; }
.top-add-menu button span { margin: 0; color: #fff; font-size: 19px; text-align: center; }
.top-add-menu button b { font-size: 15px; font-weight: 500; }
.icon-btn {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--ink);
  background: transparent;
  font-size: 20px;
}
.icon-btn:active { background: rgba(0, 0, 0, .07); }
.page {
  display: none;
  height: calc(var(--app-height, 100vh) - 58px - 64px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  overflow: auto;
  padding: 12px 12px 20px;
}
.page.active { display: block; }
.search-bar { display: grid; grid-template-columns: 1fr 72px; gap: 8px; margin-bottom: 12px; }
.conversation-search { grid-template-columns: 1fr; }
.search-bar button { border-radius: 6px; color: #fff; background: var(--green); }
.search-bar button:disabled { cursor: default; opacity: .6; }
.contact-search { grid-template-columns: 1fr; margin-bottom: 10px; }
.search-input-with-clear { position: relative; min-width: 0; }
.search-input-with-clear input { width: 100%; padding-right: 42px; }
.search-input-with-clear button { position: absolute; top: 50%; right: 5px; width: 32px; height: 32px; padding: 0; transform: translateY(-50%); border-radius: 50%; color: #8a929d; background: transparent; font-size: 22px; line-height: 1; }
.search-input-with-clear button:active { color: #4d5661; background: #e7eaee; }
.gender-icon { display: inline-grid; place-items: center; margin-left: 5px; font-size: 19px; font-family: Arial, sans-serif; font-weight: 900; line-height: 1; vertical-align: -1px; -webkit-text-stroke: .65px currentColor; text-shadow: 0 0 0 currentColor; }
.gender-icon.male { color: #2383e2; }
.gender-icon.female { color: #ef6a9b; }
.section-title { padding: 8px 4px; color: var(--muted); font-size: 13px; }
.list, .shortcut-list {
  display: grid;
  gap: 1px;
  overflow: hidden;
  border-radius: 8px;
  background: var(--line);
}
.conversation-swipe {
  position: relative;
  min-height: 68px;
  overflow: hidden;
  background: var(--panel);
  touch-action: pan-y;
}
.conversation-swipe-actions {
  position: absolute;
  inset: 0 0 0 auto;
  width: 204px;
  display: grid;
  grid-template-columns: repeat(3, 68px);
}
.swipe-action {
  min-width: 0;
  padding: 0 6px;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}
.swipe-action.pin { background: #707987; }
.swipe-action.mute { background: var(--amber); }
.swipe-action.clear { background: var(--red); }
.conversation-swipe .conversation {
  position: relative;
  z-index: 1;
  transition: transform .18s ease;
  will-change: transform;
}
.conversation-swipe.dragging .conversation { transition: none; }
.conversation-swipe.open .conversation { transform: translateX(-204px); }
.list-empty { padding: 28px 16px; text-align: center; color: var(--muted); background: var(--panel); }
.conversation, .contact-row, .request-row, .member-row {
  min-height: 68px;
  width: 100%;
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  text-align: left;
  background: var(--panel);
}
.avatar {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
  color: #fff;
  font-weight: 800;
  background: linear-gradient(135deg, var(--green), var(--blue));
}
.avatar.large { width: 64px; height: 64px; font-size: 22px; }
.avatar.group { background: linear-gradient(135deg, #2477e8, #7d5fff); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.row-main { min-width: 0; }
.row-title { display: flex; align-items: center; gap: 6px; font-size: 16px; }
.row-title strong, .row-preview { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.row-preview { margin-top: 5px; color: var(--muted); font-size: 13px; }
.draft-label { color: var(--red); font-weight: 700; }
.row-meta { display: grid; justify-items: end; gap: 7px; color: var(--muted); font-size: 12px; }
.badge {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  color: #fff;
  background: var(--red);
  font-size: 11px;
}
.quick-panel { margin-bottom: 12px; overflow: hidden; border-radius: 8px; background: var(--panel); box-shadow: 0 8px 24px rgba(24, 33, 48, .08); }
.quick-panel .contact-row { border-bottom: 1px solid var(--line); }
.scan-card { width: min(420px, calc(100vw - 24px)); }
.scan-viewport { position: relative; width: 100%; aspect-ratio: 1; overflow: hidden; border-radius: 6px; background: #111; }
.scan-viewport video { width: 100%; height: 100%; object-fit: cover; }
.scan-viewport span { position: absolute; inset: 18%; border: 2px solid rgba(255, 255, 255, .85); box-shadow: 0 0 0 999px rgba(0, 0, 0, .28); }
.scan-card > p { min-height: 22px; margin: 10px 0; color: var(--muted); text-align: center; }
.contact-group {
  display: grid;
  gap: 1px;
  background: var(--line);
}
.contact-group + .contact-group { margin-top: 8px; }
.contact-group-title {
  padding: 7px 12px;
  color: var(--muted);
  background: #f2f4f7;
  font-size: 12px;
  font-weight: 700;
}
.contact-index {
  position: fixed;
  right: max(6px, calc((100vw - 480px) / 2 + 6px));
  top: calc(118px + env(safe-area-inset-top));
  bottom: calc(78px + env(safe-area-inset-bottom));
  z-index: 3;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
}
.contact-index button {
  width: 22px;
  min-height: 16px;
  border-radius: 999px;
  color: var(--green-deep);
  background: rgba(255, 255, 255, .74);
  font-size: 11px;
  font-weight: 800;
}
.contact-index button:active {
  color: #fff;
  background: var(--green);
}
.shortcut {
  height: 58px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  color: var(--ink);
  text-align: left;
  background: var(--panel);
}
.shortcut-badge {
  min-width: 18px;
  height: 18px;
  margin-left: auto;
  padding: 0 5px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  color: #fff;
  background: var(--red);
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
}
.shortcut span, .discover-icon, .plus-menu span {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: var(--amber);
}
.discover-row {
  width: 100%;
  min-height: 62px;
  display: grid;
  grid-template-columns: 42px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 0 14px;
  border-radius: 8px;
  color: var(--ink);
  text-align: left;
  background: var(--panel);
}
.discover-icon { background: var(--blue); }
.discover-row small { color: var(--muted); }
.moments-cover {
  position: relative;
  min-height: 176px;
  margin-top: 12px;
  padding: 22px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 14px;
  color: #fff;
  background:
    radial-gradient(circle at 86% 12%, rgba(255, 255, 255, .24), transparent 31%),
    linear-gradient(145deg, #225cae 0%, #2876bd 42%, #19a66a 100%);
  box-shadow: 0 12px 30px rgba(26, 72, 117, .18);
}
.moments-cover strong { font-size: 20px; letter-spacing: .02em; }
.moments-cover p { max-width: 260px; margin: 8px 0 0; color: rgba(255, 255, 255, .82); line-height: 1.55; }
.moments-cover button {
  height: 38px;
  padding: 0 16px;
  border: 1px solid rgba(255, 255, 255, .48);
  border-radius: 999px;
  color: #fff;
  background: rgba(255, 255, 255, .16);
  backdrop-filter: blur(8px);
}
.moments-cover button:hover { background: rgba(255, 255, 255, .25); }
.moments-cover-actions { display: flex; gap: 8px; align-items: center; }
.moments-cover-actions button { position: relative; }
.moment-unread-badge {
  position: absolute;
  top: -7px;
  right: -7px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  color: #fff;
  background: #ee3f4d;
  font-size: 11px;
  line-height: 18px;
}
.moment-notification-card { max-height: min(680px, 86vh); }
.moment-notification-list { display: grid; gap: 2px; overflow-y: auto; }
.moment-notification-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 66px;
  padding: 10px 2px;
  border-bottom: 1px solid var(--line);
}
.moment-notification-row.unread { background: rgba(32, 184, 90, .06); }
.moment-notification-body { min-width: 0; display: grid; gap: 4px; }
.moment-notification-body p { margin: 0; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.moment-notification-time { color: var(--muted); font-size: 12px; }
.moment-visibility-friends { max-height: 190px; overflow-y: auto; border: 1px solid var(--line); border-radius: 6px; }
.moment-visibility-friends label { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 10px; border-bottom: 1px solid var(--line); }
.moment-visibility-friends label:last-child { border-bottom: 0; }
.moment-list { display: grid; gap: 14px; margin-top: 14px; padding-bottom: 20px; }
.moment-card {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(18, 34, 52, .07);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: 0 5px 18px rgba(28, 43, 58, .06);
}
.moment-avatar {
  width: 46px;
  height: 46px;
  padding: 0;
  overflow: hidden;
  border-radius: 9px;
  background: transparent;
}
.moment-body { min-width: 0; display: grid; gap: 10px; }
.moment-head { min-width: 0; display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.moment-author { min-width: 0; display: grid; gap: 3px; }
.moment-head button {
  min-width: 0;
  padding: 0;
  background: transparent;
  text-align: left;
}
.moment-head strong { color: #315f91; font-size: 15px; }
.moment-time { color: var(--muted); font-size: 11px; line-height: 1.35; }
.moment-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; line-height: 1.62; }
.moment-text a, .system-message-text a { color: var(--blue); text-decoration: underline; text-underline-offset: 2px; }
.moment-grid, .moment-picker { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
.moment-grid.compact { max-width: 340px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.moment-grid.single { display: block; max-width: 320px; }
.moment-grid img, .moment-picker img {
  width: 100%;
  aspect-ratio: 1;
  display: block;
  object-fit: cover;
  border-radius: 6px;
  background: #eef0f4;
  cursor: zoom-in;
}
.moment-grid.single img {
  width: auto;
  max-width: 100%;
  max-height: 420px;
  aspect-ratio: auto;
  object-fit: contain;
}
.moment-video-list video {
  width: min(100%, 420px);
  height: auto;
  aspect-ratio: var(--moment-video-ratio, 16 / 9);
  max-height: min(62vh, 520px);
  display: block;
  border-radius: 6px;
  background: #0f1115;
  object-fit: contain;
}
.moment-video-list video.is-portrait {
  width: min(62%, 260px);
  max-height: min(66vh, 560px);
}
.moment-picker.has-video { grid-template-columns: minmax(0, 1fr); }
.moment-picker-video video {
  width: 100%;
  max-height: 360px;
  display: block;
  border-radius: 6px;
  background: #0f1115;
  object-fit: contain;
}
.moment-picker-item { position: relative; min-width: 0; }
.moment-picker-item button {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  color: #fff;
  background: rgba(0, 0, 0, .55);
}
.moment-media-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.moment-media-actions .text-button {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}
.moment-media-actions span {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 4px;
  color: #fff;
  background: var(--green-deep);
  font-size: 12px;
  font-weight: 800;
}
#momentModal button:disabled {
  cursor: wait;
  opacity: .55;
}
.moment-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  padding-top: 8px;
  border-top: 1px solid rgba(18, 34, 52, .07);
}
.moment-actions button {
  min-width: 56px;
  height: 30px;
  padding: 0 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border-radius: 7px;
  color: var(--muted);
  background: transparent;
}
.moment-actions button:hover { background: #f0f3f6; }
.moment-actions button span { font-size: 16px; line-height: 1; }
.moment-actions button.active { color: #df4554; background: rgba(223, 69, 84, .08); }
.moment-social {
  display: grid;
  gap: 0;
  overflow: hidden;
  border-radius: 8px;
  background: #f4f6f8;
  color: var(--muted);
  font-size: 13px;
}
.moment-likes { padding: 8px 10px; color: #536f90; }
.moment-likes + .moment-comment { border-top: 1px solid rgba(18, 34, 52, .06); }
.moment-likes button,
.moment-comment button {
  padding: 0;
  color: var(--blue);
  background: transparent;
}
.moment-comment { padding: 7px 10px; color: var(--ink); overflow-wrap: anywhere; }
.moment-comment + .moment-comment { border-top: 1px solid rgba(18, 34, 52, .05); }
.moment-comment span { margin: 0 2px; }
.moment-comment b { color: var(--blue); }
.moment-comment button { margin-left: 8px; color: var(--blue); background: transparent; }
.moment-comment button:first-child,
.moment-comment span + button { margin-left: 0; color: var(--blue); }
.moment-comment [data-moment-action="reply-comment"] { color: var(--muted); }
.moment-comment [data-moment-action="delete-comment"] { color: var(--red); }
.moment-comment-text {
  display: block;
  margin: 2px 0 0 !important;
  white-space: pre-wrap;
  line-height: 1.5;
}
.moment-comment-text.is-collapsed {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
}
.moment-comment .moment-comment-toggle {
  margin-left: 0;
  color: var(--blue);
  font-weight: 600;
}
@media (max-width: 430px) {
  .moments-cover {
    min-height: 164px;
    padding: 18px;
    align-items: stretch;
    flex-direction: column;
    justify-content: flex-end;
  }
  .moments-cover p { max-width: none; }
  .moments-cover-actions { align-self: flex-end; }
  .moment-card { grid-template-columns: 42px minmax(0, 1fr); gap: 10px; padding: 13px 12px; }
  .moment-avatar { width: 42px; height: 42px; }
  .moment-grid { gap: 3px; }
}
.me-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 22px 14px;
  margin-bottom: 12px;
  border-radius: 8px;
  background: var(--panel);
}
.me-card h2 { margin: 0 0 7px; font-size: 21px; }
.me-card p { margin: 0; color: var(--muted); }
#meSignature {
  max-width: 220px;
  margin-top: 6px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 13px;
}
.mini-action {
  height: 28px;
  margin-top: 8px;
  padding: 0 10px;
  border-radius: 6px;
  color: var(--green-deep);
  background: rgba(32, 184, 90, .1);
  font-size: 12px;
  font-weight: 700;
}
.profile-editor {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding-bottom: 8px;
}
.profile-readonly {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #f5f6f8;
  color: var(--muted);
  font-size: 13px;
}
.status-choice-list {
  display: grid;
  gap: 8px;
}
.status-choice {
  min-height: 68px;
  display: grid;
  grid-template-columns: 12px 1fr;
  grid-template-rows: auto auto;
  column-gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  text-align: left;
}
.status-choice.active {
  border-color: rgba(32, 184, 90, .45);
  background: rgba(32, 184, 90, .08);
}
.status-choice b {
  font-size: 15px;
}
.status-choice em {
  grid-column: 2;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  line-height: 1.4;
}
.status-dot {
  width: 10px;
  height: 10px;
  grid-row: 1 / span 2;
  border-radius: 50%;
  background: #aab2bd;
}
.status-dot.online { background: var(--green); }
.status-dot.away { background: #f3b23f; }
.status-dot.invisible { background: #9aa3af; }
.user-profile-card {
  display: grid;
  justify-items: center;
  gap: 7px;
  padding: 10px 0 14px;
  text-align: center;
}
.user-profile-card h2 { margin: 4px 0 0; font-size: 22px; }
.user-profile-card p { margin: 0; color: var(--muted); line-height: 1.45; }
.profile-number-line { display: inline-flex; align-items: center; justify-content: center; gap: 5px; }
.copy-number-icon { width: 24px; height: 24px; display: inline-grid; place-items: center; padding: 0; border: 0; color: #8a929d; background: transparent; font-size: 17px; line-height: 1; }
.copy-number-icon:active { color: #525b66; }
.profile-info-list {
  width: 100%;
  display: grid;
  gap: 1px;
  overflow: hidden;
  border-radius: 8px;
  background: var(--line);
  text-align: left;
}
.profile-info-list div {
  min-height: 42px;
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  background: #f8f9fb;
}
.profile-info-list span {
  color: var(--muted);
  font-size: 13px;
}
.profile-info-list b {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--ink);
  font-size: 13px;
}
.profile-moments-row {
  width: 100%;
  min-height: 72px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  text-align: left;
  background: transparent;
}
.profile-moments-row > span:first-child { font-size: 15px; }
.profile-moments-row > b { color: var(--muted); font-size: 22px; font-weight: 400; }
.profile-remark-inline { width: 100%; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px; }
.profile-remark-inline.hidden { display: none; }
.profile-remark-inline > span { color: var(--muted); font-size: 13px; white-space: nowrap; }
.profile-remark-inline > input { min-width: 0; height: 38px; padding: 0 9px; border: 1px solid var(--line); border-radius: 6px; color: var(--ink); background: var(--panel); }
.profile-remark-inline > button { height: 38px; padding: 0 10px; border: 0; border-radius: 6px; color: #fff; background: var(--green); white-space: nowrap; }
.profile-moment-preview { min-width: 0; display: flex; justify-content: flex-start; gap: 4px; color: var(--muted); font-size: 13px; }
.profile-moment-preview img, .profile-moment-preview video { width: 48px; height: 48px; flex: 0 0 48px; border-radius: 3px; object-fit: cover; background: #eef0f4; }
.header-spacer { width: 40px; }
.friend-moments-view {
  position: fixed;
  z-index: 70;
  inset: 0;
  width: min(480px, 100%);
  height: var(--app-height, 100vh);
  margin: 0 auto;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  color: var(--ink);
  background: var(--bg);
}
.friend-moments-head {
  min-height: calc(52px + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 12px 0;
  display: grid;
  grid-template-columns: 40px 1fr 40px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.friend-moments-head strong { text-align: center; font-size: 17px; }
.friend-moments-scroll { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.friend-moments-owner { min-height: 116px; display: flex; align-items: flex-end; justify-content: flex-end; gap: 12px; padding: 20px 18px; color: #fff; background: #59616d; }
.friend-moments-owner strong { margin-bottom: 14px; font-size: 19px; text-shadow: 0 1px 2px rgba(0, 0, 0, .35); }
.friend-moments-owner .avatar { border: 3px solid #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, .2); }
.user-moment-list { padding: 10px 0 24px; }
.user-moments-more { display: block; width: calc(100% - 32px); margin: 0 16px calc(24px + env(safe-area-inset-bottom)); }
.about-card {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 8px 0 4px;
  text-align: center;
}
.about-card h2 { margin: 6px 0 2px; font-size: 20px; }
.about-card p { width: 100%; margin: 0; color: var(--muted); line-height: 1.55; word-break: break-all; }
.settings-row, .danger-row {
  min-height: 52px;
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  text-align: left;
  background: var(--panel);
}
.quiet-time-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--panel); }
.quiet-time-row label { min-width: 0; display: grid; gap: 6px; color: var(--muted); font-size: 12px; }
.quiet-time-row input { min-width: 0; height: 38px; padding: 0 8px; border: 1px solid var(--line); border-radius: 6px; color: var(--ink); background: var(--panel); }
.danger-row { display: block; margin-top: 12px; color: var(--red); text-align: center; border-radius: 8px; }
.tabbar {
  height: calc(64px + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(480px, 100%);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: #f8f9fb;
  border-top: 1px solid var(--line);
}
.tabbar button {
  position: relative;
  display: grid;
  gap: 3px;
  place-items: center;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
}
.tabbar button.active { color: var(--green-deep); font-weight: 700; }
.tab-badge {
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  position: absolute;
  top: 5px;
  left: 50%;
  transform: translateX(8px);
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  color: #fff;
  background: var(--red);
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
  line-height: 1;
}
.tab-dot {
  width: 9px;
  height: 9px;
  position: absolute;
  top: 7px;
  left: 50%;
  transform: translateX(11px);
  border-radius: 50%;
  background: var(--red);
}
.nav-icon {
  width: 25px;
  height: 25px;
  position: relative;
  display: block;
  color: currentColor;
}
.nav-chat::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 4px;
  width: 18px;
  height: 14px;
  border: 2px solid currentColor;
  border-radius: 8px;
}
.nav-chat::after {
  content: "";
  position: absolute;
  left: 8px;
  bottom: 3px;
  width: 7px;
  height: 7px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-24deg);
}
.nav-contacts::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 4px;
  width: 9px;
  height: 9px;
  border: 2px solid currentColor;
  border-radius: 50%;
}
.nav-contacts::after {
  content: "";
  position: absolute;
  left: 4px;
  bottom: 4px;
  width: 17px;
  height: 9px;
  border: 2px solid currentColor;
  border-radius: 10px 10px 5px 5px;
}
.nav-discover::before {
  content: "";
  position: absolute;
  inset: 3px;
  border: 2px solid currentColor;
  border-radius: 50%;
}
.nav-discover::after {
  content: "";
  position: absolute;
  left: 9px;
  top: 6px;
  width: 7px;
  height: 13px;
  background: currentColor;
  clip-path: polygon(50% 0, 100% 100%, 50% 76%, 0 100%);
  transform: rotate(35deg);
}
.nav-me::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 4px;
  width: 9px;
  height: 9px;
  border: 2px solid currentColor;
  border-radius: 50%;
}
.nav-me::after {
  content: "";
  position: absolute;
  left: 5px;
  bottom: 4px;
  width: 15px;
  height: 8px;
  border: 2px solid currentColor;
  border-radius: 9px 9px 3px 3px;
  border-bottom-width: 2px;
}

.chat-view {
  position: fixed;
  inset: 0;
  z-index: 10;
  width: min(480px, 100%);
  height: var(--app-height, 100vh);
  margin: 0 auto;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: #eff1f4;
}
.chat-view,
.modal,
.image-preview,
.user-profile-view,
.moment-detail-view,
.friend-moments-view,
.messages,
.modal-card {
  overscroll-behavior-x: none;
  touch-action: pan-y;
}
.swipe-back-moving {
  transition: none !important;
  box-shadow: -12px 0 26px rgba(24, 33, 48, .16);
  will-change: transform;
}
.swipe-back-complete {
  transition: transform .22s cubic-bezier(.22, .72, .18, 1) !important;
  will-change: transform;
}
body.swipe-back-active {
  overflow: hidden;
  user-select: none;
}
.shell {
  transition: transform .22s cubic-bezier(.22, .72, .18, 1), opacity .22s ease;
}
.swipe-back-indicator {
  position: fixed;
  z-index: 80;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: rgba(22, 28, 36, .78);
  box-shadow: 0 4px 14px rgba(0, 0, 0, .18);
  opacity: 0;
  pointer-events: none;
  transform: translate3d(calc(-100% + var(--swipe-indicator-x, 0px)), -50%, 0) scale(.86);
  transition: opacity .1s ease, transform .18s cubic-bezier(.22, .72, .18, 1);
}
.swipe-back-indicator.visible {
  opacity: 1;
  transform: translate3d(var(--swipe-indicator-x, 0px), -50%, 0) scale(1);
}
.swipe-back-indicator.complete {
  background: var(--green-deep);
  transform: translate3d(24px, -50%, 0) scale(1.05);
}
.swipe-back-indicator span {
  margin-top: -2px;
  font-size: 34px;
  line-height: 1;
  font-family: Arial, sans-serif;
}
.chat-head { justify-content: start; gap: 10px; }
.chat-head > div { min-width: 0; flex: 1; }
.messages { overflow: auto; padding: 14px 12px 12px; }
.message { display: flex; gap: 8px; margin: 10px 0; align-items: flex-start; }
.message, .bubble {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}
.message.mine { flex-direction: row-reverse; }
.message-stack {
  display: grid;
  justify-items: start;
  gap: 4px;
}
.mine .message-stack { justify-items: end; }
.bubble {
  max-width: min(74vw, 330px);
  padding: 10px 12px;
  display: grid;
  gap: 7px;
  border-radius: 8px;
  background: #fff;
  line-height: 1.45;
  word-break: break-word;
  box-shadow: 0 1px 1px rgba(0, 0, 0, .03);
}
.mine .bubble { background: #95ec69; }
.system-message-text {
  font-size: 15px;
  line-height: 1.62;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  -webkit-user-select: text;
  user-select: text;
}
.reply-quote {
  width: min(250px, 100%);
  min-width: 0;
  padding: 6px 8px;
  display: grid;
  gap: 2px;
  border-left: 3px solid #8b949f;
  border-radius: 3px;
  color: var(--ink);
  background: rgba(0, 0, 0, .055);
  text-align: left;
}
.mine .reply-quote { background: rgba(255, 255, 255, .36); }
.reply-quote b,
.reply-quote span {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.reply-quote b { color: var(--green-deep); font-size: 12px; }
.reply-quote span { color: #65707c; font-size: 12px; }
.reply-quote.unavailable { cursor: default; opacity: .68; }
.msg-status {
  padding: 0 3px;
  color: var(--muted);
  font-size: 12px;
}
.message.failed .bubble {
  outline: 1px solid rgba(239, 68, 68, .28);
}
.failed-status {
  padding: 0 3px;
  color: var(--red);
  background: transparent;
  font-size: 12px;
}
.bubble img { max-width: 190px; border-radius: 6px; display: block; }
.bubble img.message-image { width: min(190px, 55vw); aspect-ratio: 4 / 3; object-fit: contain; background: #e8ebef; }
.message-video-shell { position: relative; width: min(240px, 64vw); aspect-ratio: 4 / 3; overflow: hidden; background: #101214; }
.bubble video.message-video { display: block; width: 100%; height: 100%; object-fit: cover; background: #101214; }
.message-video-play { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.message-video-play::before { content: '\25B6'; width: 48px; height: 48px; display: grid; place-items: center; padding-left: 3px; border-radius: 50%; color: #fff; background: rgba(0, 0, 0, .55); font-size: 21px; }
.message-video-shell.playing .message-video-play { display: none; }
.video-missing { display: inline-flex; min-width: 150px; min-height: 72px; align-items: center; justify-content: center; color: #888; background: #e8ebef; }
.voice-bubble {
  min-width: 120px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0;
  color: inherit;
  text-align: left;
  background: transparent;
}
.voice-play-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
}
.voice-play-icon i {
  width: 3px;
  height: 8px;
  border-radius: 999px;
  background: currentColor;
  opacity: .75;
}
.voice-bubble.playing .voice-play-icon i {
  animation: voiceWave .72s ease-in-out infinite;
}
.voice-bubble.playing .voice-play-icon i:nth-child(2) { animation-delay: .12s; }
.voice-bubble.playing .voice-play-icon i:nth-child(3) { animation-delay: .24s; }
.voice-bubble.playing .voice-label {
  font-weight: 700;
}
@keyframes voiceWave {
  0%, 100% { height: 6px; opacity: .45; }
  50% { height: 18px; opacity: 1; }
}
.voice-bubble.voice-missing {
  color: var(--muted);
}
.call-record {
  min-width: 150px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.call-record span {
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--green-deep);
  font-size: 13px;
  font-weight: 800;
}
.call-record b {
  font-weight: 700;
}
.file-bubble {
  min-width: 190px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  color: inherit;
  text-decoration: none;
}
.file-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: var(--blue);
  font-weight: 800;
}
.file-info { min-width: 0; display: grid; gap: 3px; }
.file-name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: inherit; text-decoration: none; }
.file-open-name {
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
  font: inherit;
  cursor: pointer;
}
.file-size { color: var(--muted); font-size: 12px; }
.file-actions {
  grid-column: 2;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.file-action {
  height: 30px;
  border: 0;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  border-radius: 6px;
  color: var(--green-deep);
  background: rgba(255, 255, 255, .7);
  font-size: 12px;
  text-decoration: none;
}
.file-missing { color: var(--muted); }
.time-tip {
  width: fit-content;
  margin: 14px auto;
  padding: 3px 8px;
  border-radius: 999px;
  color: #fff;
  background: rgba(0, 0, 0, .18);
  font-size: 12px;
}
.history-load-state { width: fit-content; margin: 10px auto 4px; padding: 5px 9px; color: var(--muted); font-size: 12px; text-align: center; }
.history-load-state.complete { opacity: .72; }
.reply-composer {
  min-height: 48px;
  padding: 6px 10px 6px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f7f8fa;
  border-top: 1px solid var(--line);
}
.reply-composer > span {
  min-width: 0;
  flex: 1;
  padding-left: 9px;
  display: grid;
  gap: 1px;
  border-left: 3px solid var(--green);
}
.reply-composer b,
.reply-composer em {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.reply-composer b { color: var(--green-deep); font-size: 12px; }
.reply-composer em { color: var(--muted); font-size: 12px; font-style: normal; }
.reply-composer .icon-btn { flex: 0 0 34px; color: var(--muted); background: transparent; }
.composer {
  min-height: calc(58px + env(safe-area-inset-bottom));
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: 36px 1fr 36px 36px auto;
  gap: 6px;
  align-items: center;
  background: #f7f8fa;
  border-top: 1px solid var(--line);
}
.composer input { background: #fff; }
.hold-btn {
  height: 44px;
  border-radius: 6px;
  color: var(--ink);
  background: #fff;
  font-weight: 700;
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}
.send-btn { height: 38px; padding: 0 12px; border-radius: 6px; color: #fff; background: var(--green); }
.voice-panel {
  position: absolute;
  left: 50%;
  bottom: 92px;
  transform: translateX(-50%);
  width: 180px;
  height: 130px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  border-radius: 8px;
  color: #fff;
  background: rgba(0, 0, 0, .72);
}
.voice-panel span { font-size: 13px; color: rgba(255, 255, 255, .8); }
.upload-progress {
  position: absolute;
  left: 50%;
  bottom: calc(72px + env(safe-area-inset-bottom));
  z-index: 8;
  width: min(320px, calc(100% - 32px));
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(20, 28, 40, .88);
  color: #fff;
  box-shadow: 0 10px 26px rgba(0, 0, 0, .18);
}
.upload-progress strong {
  font-size: 13px;
}
.upload-progress span {
  height: 6px;
  grid-column: 1 / -1;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, .22);
}
.upload-progress i {
  width: 0;
  height: 100%;
  display: block;
  border-radius: inherit;
  background: var(--green);
  transition: width .18s ease;
}
.upload-progress b {
  font-size: 12px;
}
.plus-menu {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(58px + env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  padding: 14px;
  background: #f7f8fa;
  border-top: 1px solid var(--line);
}
.plus-menu button { display: grid; gap: 7px; place-items: center; color: var(--ink); background: transparent; }
.plus-menu span { width: 46px; height: 46px; background: #fff; color: var(--green-deep); font-weight: 800; }
.emoji-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(58px + env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  padding: 12px;
  background: #f7f8fa;
  border-top: 1px solid var(--line);
}
.emoji-panel button {
  height: 40px;
  border-radius: 6px;
  color: var(--ink);
  background: #fff;
  font-size: 20px;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: end center;
  background: rgba(0, 0, 0, .35);
}
.user-profile-view {
  position: fixed;
  z-index: 85;
  inset: 0;
  width: min(480px, 100%);
  height: var(--app-height, 100vh);
  margin: 0 auto;
  color: var(--ink);
  background: var(--bg);
}
.user-profile-view.hidden { display: none; }
.moment-detail-view {
  position: fixed;
  z-index: 86;
  inset: 0;
  width: min(480px, 100%);
  height: var(--app-height, 100vh);
  margin: 0 auto;
  color: var(--ink);
  background: var(--bg);
}
.moment-detail-view.hidden { display: none; }
.moment-detail-scroll { min-height: 0; overflow-y: auto; padding: 4px 12px calc(28px + env(safe-area-inset-bottom)); }
.moment-detail-scroll .moment-card { margin-top: 8px; }
.user-profile-page { height: 100%; display: grid; grid-template-rows: auto minmax(0, 1fr); }
.user-profile-head { min-height: calc(52px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 12px 0; display: grid; grid-template-columns: 40px 1fr 40px; align-items: center; border-bottom: 1px solid var(--line); background: var(--panel); }
.user-profile-head strong { text-align: center; font-size: 17px; }
.user-profile-scroll { min-height: 0; overflow-y: auto; padding: 16px 16px calc(28px + env(safe-area-inset-bottom)); overscroll-behavior: contain; }
.user-profile-scroll > .primary { margin-top: 12px; }
.modal-card {
  width: min(480px, 100%);
  display: grid;
  gap: 1px;
  padding: 12px 12px calc(18px + env(safe-area-inset-bottom));
  border-radius: 8px 8px 0 0;
  background: var(--panel);
}
.modal-card header { height: 46px; display: flex; align-items: center; justify-content: space-between; }
.modal-list { display: grid; gap: 1px; overflow: hidden; border-radius: 8px; background: var(--line); }
.device-session-list { max-height: min(58vh, 520px); overflow-y: auto; }
.device-session-row { min-width: 0; display: flex; align-items: center; gap: 12px; padding: 14px 12px; background: var(--panel); }
.device-session-main { min-width: 0; flex: 1; display: grid; gap: 4px; }
.device-session-main strong { min-width: 0; overflow-wrap: anywhere; font-size: 15px; }
.device-session-main strong em { display: inline-block; margin-left: 8px; color: var(--green); font-size: 12px; font-style: normal; font-weight: 500; }
.device-session-main span, .device-session-main small { color: var(--muted); font-size: 12px; }
.device-session-row > button { flex: 0 0 auto; border: 0; background: transparent; color: var(--red); padding: 8px; }
.forward-message-card { max-height: min(82vh, 720px); grid-template-rows: auto auto auto minmax(120px, 1fr) auto; }
.forward-message-preview {
  overflow: hidden;
  padding: 9px 11px;
  border-left: 3px solid var(--green);
  color: var(--muted);
  background: #f5f6f8;
  font-size: 13px;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.forward-target-list { min-height: 120px; max-height: min(48vh, 430px); overflow-y: auto; }
.forward-target-row {
  min-height: 66px;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) 24px;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  background: var(--panel);
  cursor: pointer;
}
.forward-target-row.selected { background: rgba(32, 184, 90, .08); }
.forward-target-row input {
  width: 22px;
  height: 22px;
  margin: 0;
  accent-color: var(--green);
}
.forward-submit-row {
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.forward-submit-row span { color: var(--muted); font-size: 13px; }
.forward-submit-row .primary { width: auto; min-width: 92px; padding: 0 18px; }
.forward-submit-row .primary:disabled { opacity: .5; cursor: default; }
.form-row {
  display: grid;
  gap: 7px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
}
.form-row input, .form-row textarea, .form-row select {
  height: 44px;
  padding: 0 13px;
  border-radius: 6px;
  background: #f5f6f8;
  color: var(--ink);
  border: 0;
  outline: 0;
}
.sms-inline > div {
  display: grid;
  grid-template-columns: 1fr 112px;
  gap: 8px;
}
.sms-inline button {
  height: 44px;
  border-radius: 6px;
  color: #fff;
  background: var(--blue);
  font-size: 13px;
  font-weight: 700;
}
.sms-inline button:disabled {
  opacity: .65;
}
.form-row textarea {
  min-height: 96px;
  padding: 10px 13px;
  border: 0;
  outline: 0;
  resize: vertical;
}
.message-action-card { gap: 8px; }
.recall-tip {
  display: inline-block;
  color: var(--muted);
  font-size: 13px;
}
.member-check {
  width: 22px;
  height: 22px;
  accent-color: var(--green);
}
.member-action-row {
  min-height: 34px;
  width: 100%;
  padding: 0 12px;
  color: var(--red);
  text-align: right;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.member-action-row.neutral { color: var(--green-deep); }
.member-row .member-action-row {
  width: auto;
  justify-self: end;
  border-bottom: 0;
  background: transparent;
}
.request-actions { display: flex; gap: 8px; }
.request-actions button { height: 30px; padding: 0 10px; border-radius: 6px; color: #fff; background: var(--green); }
.request-actions button.reject { color: var(--muted); background: #eef0f4; }
.request-time { font-size: 12px; }
.request-status {
  min-width: 64px;
  justify-self: end;
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}
.call-card {
  justify-items: center;
  gap: 14px;
  padding-top: 26px;
  text-align: center;
}
.call-video {
  width: 100%;
  aspect-ratio: 4 / 3;
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  background: #101418;
}
.call-video img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}
.call-video video {
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 96px;
  height: 128px;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, .85);
  border-radius: 8px;
  background: #222;
}
.call-video #remoteCallMedia { inset: 0; width: 100%; height: 100%; border: 0; border-radius: 0; background: #101418; }
.call-video #remoteCallMedia.hidden { display: none; }
.call-video #remoteCallVideo.hidden { display: none; }
.call-video #localCallVideo { z-index: 2; }
.call-avatar {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  color: #fff;
  font-size: 24px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--green), var(--blue));
}
.call-card strong {
  font-size: 20px;
}
.call-mode {
  font-size: 13px;
  font-weight: 700;
}
.call-card p {
  margin: 0;
  color: var(--muted);
}
.call-card p.network-warning {
  color: var(--red);
  font-weight: 700;
}
.call-duration {
  min-height: 18px;
  font-size: 13px;
  color: var(--muted);
}
.call-quality {
  min-height: 20px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  color: var(--muted);
  font-size: 12px;
}
.call-quality i {
  width: 3px;
  border-radius: 2px;
  background: currentColor;
}
.call-quality i:nth-child(1) { height: 6px; }
.call-quality i:nth-child(2) { height: 10px; }
.call-quality i:nth-child(3) { height: 14px; }
.call-quality span { margin-left: 5px; }
.call-quality.good { color: var(--green-deep); }
.call-quality.fair { color: #b7791f; }
.call-quality.poor { color: var(--red); }
.call-quality.fair i:nth-child(3),
.call-quality.poor i:nth-child(2),
.call-quality.poor i:nth-child(3) { opacity: .2; }
.call-media-state {
  min-height: 18px;
  font-size: 12px;
}
.call-controls {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
  gap: 10px;
}
.call-controls button {
  min-height: 68px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 6px;
  border-radius: 8px;
  color: var(--ink);
  background: #f2f4f7;
}
.call-controls span {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: #707987;
  font-weight: 800;
}
.call-controls b {
  font-size: 12px;
  font-weight: 700;
}
.call-controls button.active {
  color: var(--red);
  background: #fff1f1;
}
.call-controls button.active span {
  background: var(--red);
}
.call-controls button:disabled {
  cursor: default;
  opacity: .55;
}
.call-actions {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.call-actions button {
  height: 44px;
  border-radius: 999px;
  color: #fff;
  font-weight: 700;
}
.call-accept {
  background: var(--green);
}
.call-hang {
  background: var(--red);
}
.call-actions .call-accept.hidden + .call-hang {
  grid-column: 1 / -1;
}
.request-status.accepted { color: var(--green-deep); }
.request-status.rejected { color: var(--red); }
.switch-row {
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.switch-row input { width: 22px; height: 22px; }
.toast {
  position: fixed;
  left: 50%;
  bottom: 92px;
  z-index: 30;
  max-width: min(320px, calc(100vw - 36px));
  transform: translateX(-50%);
  padding: 10px 14px;
  border-radius: 999px;
  color: #fff;
  background: rgba(0, 0, 0, .78);
  font-size: 14px;
}
.connection-banner { position: fixed; z-index: 88; top: calc(8px + env(safe-area-inset-top)); left: 50%; width: min(360px, calc(100vw - 28px)); min-height: 42px; display: flex; align-items: center; justify-content: space-between; gap: 12px; transform: translateX(-50%); padding: 9px 12px; border: 1px solid #efc36d; border-radius: 7px; color: #614817; background: #fff4d8; box-shadow: 0 5px 16px rgba(0, 0, 0, .14); text-align: left; }
.connection-banner.hidden { display: none; }
.connection-banner span { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.connection-banner b { flex: 0 0 auto; color: #9b6500; font-size: 12px; }
.list-skeleton { display: grid; gap: 1px; overflow: hidden; border-radius: 8px; background: var(--line); }
.skeleton-row { min-height: 68px; display: grid; grid-template-columns: 44px 1fr 48px; align-items: center; gap: 10px; padding: 10px 12px; background: var(--panel); }
.skeleton-block { border-radius: 5px; background: linear-gradient(90deg, #e9edf1 25%, #f5f7f9 50%, #e9edf1 75%); background-size: 220% 100%; animation: skeleton-loading 1.2s ease-in-out infinite; }
.skeleton-avatar { width: 44px; height: 44px; border-radius: 50%; }
.skeleton-lines { display: grid; gap: 8px; }
.skeleton-lines i { display: block; height: 11px; }
.skeleton-lines i:last-child { width: 62%; }
.skeleton-meta { width: 42px; height: 10px; }
@keyframes skeleton-loading { to { background-position-x: -220%; } }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid #2383e2; outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
.image-preview {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 54px 14px 24px;
  background: rgba(0, 0, 0, .92);
}
.image-preview-stage {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  overflow: hidden;
  touch-action: none;
  cursor: grab;
}
.image-preview-stage.dragging { cursor: grabbing; }
#callModal { z-index: 90; }
.image-preview .icon-btn {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top));
  right: 12px;
  color: #fff;
  background: rgba(255, 255, 255, .12);
}
.preview-actions {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
}
.preview-actions a,
.preview-actions button {
  height: 34px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  color: #fff;
  background: rgba(255, 255, 255, .14);
  font-size: 13px;
  text-decoration: none;
}
.image-preview img {
  max-width: min(100%, 720px);
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
  transform: translate3d(0, 0, 0) scale(1);
  transform-origin: center center;
  will-change: transform;
  user-select: none;
  -webkit-user-drag: none;
}

.capture-view {
  position: fixed;
  inset: 0;
  z-index: 110;
  width: min(480px, 100%);
  height: var(--app-height, 100vh);
  margin: 0 auto;
  overflow: hidden;
  background: #090b0e;
}
.capture-view video { width: 100%; height: 100%; object-fit: cover; }
.capture-view.front-camera video { transform: scaleX(-1); }
.capture-shade { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(rgba(0,0,0,.42), transparent 22%, transparent 68%, rgba(0,0,0,.66)); }
.capture-view header { position: absolute; top: env(safe-area-inset-top); left: 0; right: 0; height: 64px; padding: 0 16px; display: grid; grid-template-columns: 48px 1fr 48px; align-items: center; color: #fff; }
.capture-view header strong { text-align: center; font-size: 16px; }
.capture-icon-btn { width: 44px; height: 44px; border-radius: 50%; color: #fff; background: rgba(0,0,0,.38); font-size: 27px; }
.capture-controls { position: absolute; left: 0; right: 0; bottom: calc(30px + env(safe-area-inset-bottom)); display: flex; align-items: center; justify-content: center; }
.capture-shutter-btn { width: 82px; height: 82px; padding: 5px; touch-action: none; border: 3px solid #fff; border-radius: 50%; background: transparent; }
.capture-shutter-btn i { display: block; width: 100%; height: 100%; border-radius: 50%; background: #fff; transition: transform .16s ease, border-radius .16s ease, background .16s ease; }
.capture-shutter-btn.pressing i { transform: scale(.9); }
.capture-shutter-btn.recording i { border-radius: 12px; background: #ef4444; transform: scale(.64); }
.capture-review { position: fixed; inset: 0; z-index: 112; width: min(480px, 100%); height: var(--app-height, 100vh); margin: 0 auto; overflow: hidden; background: #050608; }
.capture-review-media { width: 100%; height: 100%; display: grid; place-items: center; }
.capture-review-media img, .capture-review-media video { width: 100%; height: 100%; object-fit: contain; }
.capture-review-actions { position: absolute; left: 0; right: 0; bottom: calc(30px + env(safe-area-inset-bottom)); display: flex; justify-content: center; gap: 32px; }
.capture-review-actions button { min-width: 116px; height: 46px; padding: 0 18px; border-radius: 23px; color: #fff; background: rgba(0,0,0,.62); }
.capture-review-actions button.primary { background: var(--green-deep); }
.moment-media-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.moment-media-actions .text-button { min-width: 0; justify-content: center; padding: 0 8px; }

@media (min-width: 700px) {
  body { display: grid; place-items: center; min-height: 100vh; }
  .shell, .chat-view { min-height: 860px; max-height: 860px; border-radius: 8px; overflow: hidden; box-shadow: var(--shadow); }
  .tabbar { position: absolute; }
}

.search-results { max-height: min(52vh, 420px); overflow: auto; }
.search-result-row {
  width: 100%;
  padding: 10px 0;
  display: grid;
  text-align: left;
  border-bottom: 1px solid var(--line);
  background: transparent;
}
.search-result-row .row-title { display: flex; justify-content: space-between; gap: 12px; }
.search-result-row em { color: var(--muted); font-style: normal; font-size: 12px; }
.search-result-row .row-sub { margin-top: 4px; color: var(--muted); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.search-result-row .row-sub b {
  margin-right: 6px;
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--green-deep);
  background: rgba(7, 193, 96, .12);
  font-size: 12px;
}
.search-result-row mark {
  padding: 0 2px;
  border-radius: 3px;
  color: inherit;
  background: rgba(255, 206, 70, .55);
}
.message-hit .bubble { outline: 2px solid var(--blue); outline-offset: 2px; }
.empty-tip { padding: 18px 0; color: var(--muted); text-align: center; }
.contact-card-picker { width: min(440px, calc(100vw - 24px)); }
.contact-picker-row { width: 100%; border: 0; background: #fff; text-align: left; }
.contact-picker-row:disabled { opacity: .58; cursor: default; }
.contact-send-label { color: var(--green-deep); font-size: 13px; }
.contact-message-card { display: block; width: 250px; padding: 0; overflow: hidden; border: 0; background: transparent; color: inherit; text-align: left; }
.contact-card-main { display: flex; align-items: center; gap: 11px; padding: 12px; }
.contact-card-main .avatar { width: 46px; height: 46px; flex: 0 0 46px; }
.contact-card-copy { display: grid; min-width: 0; gap: 5px; }
.contact-card-copy strong { display: flex; align-items: center; gap: 5px; overflow: hidden; font-size: 15px; white-space: nowrap; text-overflow: ellipsis; }
.contact-card-copy > span { color: var(--muted); font-size: 12px; }
.contact-card-footer { display: block; padding: 7px 12px; border-top: 1px solid rgba(0, 0, 0, .08); color: var(--muted); font-size: 11px; }
.contact-card-missing { color: var(--muted); }
.contact-message-card.unavailable { filter: grayscale(1); opacity: .62; cursor: default; }
