/* 「都聊」界面样式：都聊式布局 + 珊瑚粉品牌色，跟随系统深浅色。 */

:root {
  --accent: #ff5c7a;
  --accent-soft: #ffe8ed;
  --accent-press: #ef4b6a;
  --bg: #f2f2f5;
  --bg-2: #ffffff;
  --bg-3: #f7f7f9;
  --bubble-me: #95ec69;
  --bubble-me-text: #101010;
  --bubble-other: #ffffff;
  --text: #191919;
  --text-2: #7a7a80;
  --text-3: #b0b0b6;
  --line: #e6e6ea;
  --line-strong: #dcdce2;
  --green: #07c160;
  --red: #ff3b30;
  --blue: #0a84ff;
  --shadow: 0 6px 24px rgba(20, 20, 30, 0.08);
  --radius: 12px;
  --header-h: 52px;
  --tab-h: 58px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111114;
    --bg-2: #1b1b1f;
    --bg-3: #232328;
    --bubble-me: #3d7a2a;
    --bubble-me-text: #eaf7e2;
    --bubble-other: #26262c;
    --text: #f2f2f4;
    --text-2: #9a9aa2;
    --text-3: #6c6c74;
    --line: #2c2c33;
    --line-strong: #3a3a42;
    --accent-soft: #3a2027;
    --shadow: 0 8px 28px rgba(0, 0, 0, 0.4);
  }
}

[data-theme='light'] {
  color-scheme: light;
}
[data-theme='dark'] {
  color-scheme: dark;
  --bg: #111114;
  --bg-2: #1b1b1f;
  --bg-3: #232328;
  --bubble-me: #3d7a2a;
  --bubble-me-text: #eaf7e2;
  --bubble-other: #26262c;
  --text: #f2f2f4;
  --text-2: #9a9aa2;
  --text-3: #6c6c74;
  --line: #2c2c33;
  --line-strong: #3a3a42;
  --accent-soft: #3a2027;
}

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

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Helvetica Neue', 'Noto Sans SC', system-ui, sans-serif;
  font-size: 16px;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

button {
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
}

img {
  display: block;
}

.app-shell {
  position: relative;
  height: 100%;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

@media (min-width: 620px) {
  body {
    background: #e9e9ee;
  }
  .app-shell {
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.12);
  }
}

/* ---------------------------------------------------------------- 通用 */

.page {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  z-index: 1;
  animation: page-in 0.18s ease;
}

.page.no-anim {
  animation: none;
}

@keyframes page-in {
  from {
    opacity: 0.4;
    transform: translateX(18px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.page-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.header {
  flex: none;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: calc(var(--safe-top) + 6px) 8px 6px;
  min-height: var(--header-h);
  background: var(--bg-3);
  border-bottom: 0.5px solid var(--line);
  position: relative;
  z-index: 3;
}

.header h1 {
  font-size: 17px;
  font-weight: 600;
  margin: 0;
  flex: 1;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.2px;
}

.header .header-side {
  min-width: 76px;
  display: flex;
  align-items: center;
  gap: 2px;
}

.header .header-side.right {
  justify-content: flex-end;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  transition: background 0.15s;
}

.icon-btn:active {
  background: rgba(120, 120, 130, 0.14);
}

.icon-btn svg {
  width: 22px;
  height: 22px;
}

.icon-btn.small svg {
  width: 19px;
  height: 19px;
}

.text-btn {
  font-size: 15px;
  color: var(--accent);
  padding: 8px 10px;
  border-radius: 10px;
  font-weight: 500;
}

.text-btn:active {
  background: var(--accent-soft);
}

.text-btn[disabled] {
  color: var(--text-3);
}

.primary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 46px;
  padding: 0 22px;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.5px;
  transition: transform 0.12s, background 0.15s;
}

.primary-btn:active {
  background: var(--accent-press);
  transform: scale(0.985);
}

.primary-btn[disabled] {
  opacity: 0.45;
}

.primary-btn.block {
  width: 100%;
}

.ghost-btn {
  height: 34px;
  padding: 0 14px;
  border-radius: 9px;
  border: 0.5px solid var(--line-strong);
  color: var(--text);
  font-size: 13.5px;
  background: var(--bg-2);
}

.ghost-btn:active {
  background: var(--bg-3);
}

.ghost-btn.danger {
  color: var(--red);
}

.field {
  display: flex;
  text-align: left;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 8px 16px;
  background: var(--bg-2);
  border-bottom: 0.5px solid var(--line);
  font-size: 16px;
}

.field:last-child {
  border-bottom: 0;
}

.field .field-label {
  flex: none;
  color: var(--text);
  min-width: 96px;
}

.field .field-value {
  flex: 1;
  text-align: right;
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.field-count {
  float: right;
  font-size: 11.5px;
  color: var(--text-3);
  font-weight: 400;
}

.field .field-value.placeholder {
  color: var(--text-3);
}

.field .chevron {
  flex: none;
  color: var(--text-3);
  display: flex;
  align-items: center;
}

.field input,
.field textarea,
.field select {
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  text-align: right;
  font-size: 16px;
  min-width: 0;
}

.field input::placeholder,
.field textarea::placeholder {
  color: var(--text-3);
}

.field textarea {
  text-align: left;
  resize: none;
  min-height: 76px;
  line-height: 1.5;
}

.field.stacked {
  display: block;
  padding: 14px 16px;
}

.field.stacked.editable .field-label {
  font-size: 16px;
  color: var(--text);
}

.field.stacked .field-label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  color: var(--text-2);
}

.field .inline-input {
  width: 100%;
  border: 0;
  outline: 0;
  background: var(--bg-3);
  border-radius: 10px;
  padding: 11px 12px;
  font-size: 15px;
  color: var(--text);
  text-align: left;
}

.field.stacked textarea {
  width: 100%;
  text-align: left;
  background: var(--bg-3);
  border-radius: 10px;
  padding: 10px 12px;
  min-height: 88px;
}

.field-group {
  background: var(--bg-2);
  margin: 10px 0;
  border-top: 0.5px solid var(--line);
  border-bottom: 0.5px solid var(--line);
}

.group-title {
  font-size: 13px;
  color: var(--text-2);
  padding: 18px 16px 8px;
}

.hint-text {
  font-size: 12.5px;
  color: var(--text-3);
  padding: 8px 16px 4px;
  line-height: 1.5;
}

.avatar {
  position: relative;
  border-radius: var(--avatar-radius, 22%);
  overflow: hidden;
  flex: none;
  background: var(--bg-3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: #fff;
  user-select: none;
}

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

.avatar.round {
  border-radius: 50%;
}

.avatar.sq {
  border-radius: var(--avatar-radius, 22%);
}

.avatar-grid {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: grid;
  gap: 2px;
  padding: 2px;
  background: var(--bg-3);
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr;
}

.avatar-grid.n3,
.avatar-grid.n4 {
  grid-template-rows: 1fr 1fr;
}

.avatar-grid .avatar {
  border-radius: 4px;
  width: 100%;
  height: 100%;
}

.avatar-grid.one {
  grid-template-columns: 1fr;
}

.badge {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--red);
  color: #fff;
  font-size: 11.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.dot-badge {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--red);
}

.offline-bar {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 560px;
  z-index: 60;
  background: #fff4e5;
  color: #9a6212;
  font-size: 12.5px;
  text-align: center;
  padding: 5px 12px;
  border-bottom: 0.5px solid #f2e1c9;
}

[data-theme='dark'] .offline-bar {
  background: #2a2113;
  color: #e0b061;
  border-bottom-color: #3a2d18;
}

.empty {
  padding: 70px 24px;
  text-align: center;
  color: var(--text-3);
  font-size: 14px;
  line-height: 1.7;
}

.empty .empty-emoji {
  font-size: 40px;
  margin-bottom: 12px;
  opacity: 0.9;
}

/* ---------------------------------------------------------------- Tabbar */

.tabbar {
  flex: none;
  display: flex;
  padding-bottom: var(--safe-bottom);
  background: var(--bg-3);
  border-top: 0.5px solid var(--line);
  position: relative;
  z-index: 4;
}

.tab {
  flex: 1;
  height: var(--tab-h);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--text-3);
  font-size: 10.5px;
  position: relative;
}

.tab svg {
  width: 25px;
  height: 25px;
}

.tab.active {
  color: var(--accent);
}

.tab .badge {
  position: absolute;
  top: 6px;
  left: 50%;
  margin-left: 6px;
  transform: translateX(0);
}

/* ---------------------------------------------------------------- 登录 */

.auth {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 24px 26px calc(24px + var(--safe-bottom));
  background: radial-gradient(120% 80% at 50% 0%, #ffe4ea 0%, var(--bg) 58%);
  overflow-y: auto;
}

[data-theme='dark'] .auth {
  background: radial-gradient(120% 80% at 50% 0%, #3a1d26 0%, var(--bg) 60%);
}

/* 登录 / 注册卡片里的样式在 css/auth.css（与 Web 共用），这里只留铺满屏幕的背景 .auth */

.boot-screen {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.boot-logo {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  object-fit: cover;
  display: block;
  box-shadow: 0 10px 24px rgba(255, 92, 122, 0.28);
}

.boot-text {
  color: var(--text-2);
  font-size: 13.5px;
}

/* ---------------------------------------------------------------- 列表 */

.list-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--bg-2);
  border-bottom: 0.5px solid var(--line);
  position: relative;
  min-height: 64px;
}

.list-row:last-child {
  border-bottom: 0;
}

.list-row:active {
  background: var(--bg-3);
}

.list-row .row-main {
  flex: 1;
  min-width: 0;
}

.list-row .row-title {
  font-size: 16.5px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-row .row-sub {
  font-size: 13px;
  color: var(--text-2);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-row .row-side {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  color: var(--text-3);
  font-size: 12px;
}

.list-row .row-chevron {
  color: var(--text-3);
  display: flex;
}

.list-group {
  margin: 10px 12px;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-2);
  border: 0.5px solid var(--line);
}


.search-bar {
  margin: 10px 12px;
  height: 38px;
  border-radius: 10px;
  background: var(--bg-3);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  color: var(--text-3);
}

.search-bar input {
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 15px;
}

.search-bar svg {
  width: 17px;
  height: 17px;
}

.self-card {
  margin: 14px 12px;
  padding: 18px 16px;
  background: linear-gradient(160deg, var(--bg-2), var(--bg-2));
  border-radius: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  border: 0.5px solid var(--line);
}

.self-card .name {
  font-size: 20px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.self-card .chatid {
  font-size: 13px;
  color: var(--text-2);
  margin-top: 5px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.self-card .sig {
  font-size: 12.5px;
  color: var(--text-3);
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 210px;
}

.menu-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-2);
  border-bottom: 0.5px solid var(--line);
  font-size: 16px;
}

.menu-row:last-child {
  border-bottom: 0;
}

.menu-row .menu-icon {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex: none;
}

.menu-row .menu-icon svg {
  width: 17px;
  height: 17px;
}

.menu-row .menu-label {
  flex: 1;
}

.menu-row .menu-value {
  color: var(--text-3);
  font-size: 13.5px;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------------------------------------------------------------- 聊天 */

.chat-page {
  background: var(--bg);
}

.chat-header {
  background: var(--bg-3);
}

.chat-header .title-stack {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
}

.chat-header .title-stack .name {
  font-size: 17px;
  font-weight: 600;
  max-width: 210px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-header .title-stack .typing {
  font-size: 11.5px;
  color: var(--green);
  height: 13px;
  opacity: 0;
  transition: opacity 0.2s;
}

.chat-header .title-stack .typing.show {
  opacity: 1;
}

.messages {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 12px 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background:
    radial-gradient(120% 60% at 50% 0%, rgba(255, 92, 122, 0.05), transparent 60%),
    var(--bg);
}

.msg-time {
  text-align: center;
  font-size: 11.5px;
  color: var(--text-3);
  margin: 12px 0 6px;
}

.msg {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 3px 0;
  animation: msg-in 0.18s ease;
}

@keyframes msg-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.msg .bubble {
  max-width: 100%;
  padding: 9px 12px;
  font-size: 16px;
  line-height: 1.45;
  border-radius: 10px;
  word-break: break-word;
  white-space: pre-wrap;
  position: relative;
}

.msg.other .bubble {
  background: var(--bubble-other);
  color: var(--text);
  border-top-left-radius: 3px;
}

.msg.mine {
  flex-direction: row-reverse;
}

.msg.mine .bubble {
  background: var(--bubble-me);
  color: var(--bubble-me-text);
  border-top-right-radius: 3px;
}

.msg .sender-name {
  font-size: 11px;
  color: var(--text-3);
  margin: 0 0 3px 2px;
}

.msg .msg-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
  max-width: 76%;
  flex: 0 1 auto;
}

.msg.mine .msg-col {
  align-items: flex-end;
}

.msg .avatar {
  width: 38px;
  height: 38px;
  font-size: 15px;
  border-radius: var(--avatar-radius, 22%);
}

.msg .avatar.pressable:active {
  transform: scale(0.94);
  opacity: 0.85;
}

.msg .sender-name.mine-name {
  text-align: right;
  margin: 0 2px 3px 0;
}

.msg-pending {
  align-self: flex-end;
  font-size: 11px;
  color: var(--text-3);
  margin-right: 46px;
  margin-top: -2px;
}

.msg-pending .spin {
  display: inline-block;
  width: 10px;
  height: 10px;
  border: 1.5px solid var(--text-3);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: -1px;
  margin-right: 4px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.composer {
  flex: none;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 8px 10px calc(8px + var(--safe-bottom));
  background: var(--bg-3);
  border-top: 0.5px solid var(--line);
}

.composer .composer-field {
  flex: 1;
  min-height: 38px;
  max-height: 120px;
  background: var(--bg-2);
  border-radius: 9px;
  padding: 8px 11px;
  display: flex;
  align-items: center;
  border: 0.5px solid var(--line);
}

.composer textarea {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  resize: none;
  font-size: 16px;
  line-height: 1.4;
  max-height: 100px;
}

.composer .send-btn {
  flex: none;
  height: 38px;
  padding: 0 16px;
  border-radius: 9px;
  background: var(--green);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
}

.composer .send-btn:active {
  filter: brightness(0.94);
}

.composer .send-btn[disabled] {
  background: var(--line-strong);
  color: var(--text-3);
}

.mention-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 12.5px;
  margin: 0 6px 6px 10px;
}

.mention-row {
  display: flex;
  align-items: center;
  padding: 0 6px;
}

/* ---------------------------------------------------------------- 添加好友 */

.wizard-avatar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 22px 16px 12px;
}

.wizard-avatar .avatar {
  width: 88px;
  height: 88px;
  font-size: 34px;
  border-radius: var(--avatar-radius, 22%);
}

.wizard-avatar .tip {
  font-size: 12.5px;
  color: var(--text-3);
}

/* 弹层（选择列表、确认框、输入框、选头像、面板）的样式统一在 css/dialogs.css，App 与 Web 共用 */

/* ---------------------------------------------------------------- 裁剪 */

.crop-screen {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: #0b0b0d;
  display: flex;
  flex-direction: column;
}

.crop-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(var(--safe-top) + 10px) 14px 10px;
  color: #fff;
  flex: none;
}

.crop-top button {
  color: #fff;
  font-size: 15.5px;
  padding: 6px 8px;
}

.crop-top .crop-title {
  font-size: 16px;
  font-weight: 600;
}

.crop-stage {
  flex: 1;
  position: relative;
  overflow: hidden;
  touch-action: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.crop-stage canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.crop-frame {
  position: absolute;
  border: 1.5px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.55);
  pointer-events: none;
  border-radius: 4px;
}

.crop-frame::before,
.crop-frame::after {
  content: '';
  position: absolute;
  background: rgba(255, 255, 255, 0.28);
}

.crop-frame::before {
  left: 33.33%;
  right: 33.33%;
  top: 0;
  bottom: 0;
  border-left: 0.5px solid rgba(255, 255, 255, 0.35);
  border-right: 0.5px solid rgba(255, 255, 255, 0.35);
  background: transparent;
}

.crop-frame::after {
  top: 33.33%;
  bottom: 33.33%;
  left: 0;
  right: 0;
  border-top: 0.5px solid rgba(255, 255, 255, 0.35);
  border-bottom: 0.5px solid rgba(255, 255, 255, 0.35);
  background: transparent;
}

.crop-bottom {
  flex: none;
  padding: 16px 20px calc(20px + var(--safe-bottom));
  display: flex;
  align-items: center;
  gap: 14px;
}

.crop-bottom input[type='range'] {
  flex: 1;
  accent-color: var(--accent);
}

.crop-bottom button {
  color: var(--accent);
  font-size: 16px;
  font-weight: 600;
  padding: 8px 10px;
}

/* 朋友圈（头图、动态卡片、评论栏、发朋友圈表单）的样式在 css/moments.css，与 Web 共用 */

/* ---------------------------------------------------------------- 群设置 / 成员 */

.member-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px 8px;
  padding: 16px;
  background: var(--bg-2);
}

.member-grid .member {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  position: relative;
}

.member-grid .member .avatar {
  width: 48px;
  height: 48px;
}

.member-grid .member .name {
  font-size: 11.5px;
  color: var(--text-2);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.member-grid .member .remove {
  position: absolute;
  top: -5px;
  right: calc(50% - 30px);
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--red);
  color: #fff;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(90px + var(--safe-bottom));
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.78);
  color: #fff;
  font-size: 13.5px;
  padding: 10px 16px;
  border-radius: 10px;
  z-index: 200;
  max-width: 80vw;
  text-align: center;
  animation: toast-in 0.2s ease;
  pointer-events: none;
  line-height: 1.4;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translate(-50%, 8px);
  }
}

.kv {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  font-size: 14px;
  border-bottom: 0.5px solid var(--line);
  background: var(--bg-2);
}

.kv:last-child {
  border-bottom: 0;
}

.kv .k {
  color: var(--text-2);
}

.kv .v {
  color: var(--text);
  text-align: right;
  max-width: 60%;
  word-break: break-all;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
}

.loading-row {
  padding: 16px;
  text-align: center;
  color: var(--text-3);
  font-size: 13px;
}

.friend-moments-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 16px;
  background: var(--bg-2);
  border-bottom: 0.5px solid var(--line);
}

.friend-moments-head .name {
  font-size: 17px;
  font-weight: 600;
}

.friend-moments-head .sub {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 3px;
}

/* 会话列表：AI 标识、置顶/免打扰、左滑操作 */
.ai-badge {
  display: inline-block;
  margin-left: 4px;
  padding: 0 4px;
  height: 13px;
  line-height: 13px;
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.2px;
  vertical-align: super;
}

.chat-tag {
  display: inline-block;
  margin-left: 4px;
  padding: 0 4px;
  height: 14px;
  line-height: 14px;
  border-radius: 4px;
  background: var(--bg-3);
  color: var(--text-3);
  font-size: 9px;
  vertical-align: 1px;
}

.swipe-row {
  position: relative;
  overflow: hidden;
}

.swipe-actions {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  display: flex;
  z-index: 0;
}

.swipe-actions button {
  width: 62px;
  border: 0;
  background: var(--bg-2);
  color: var(--text);
  font-size: 11.5px;
  line-height: 1.3;
  padding: 0 4px;
}

.swipe-actions button.danger {
  background: var(--danger);
  color: #fff;
}

.chat-row {
  position: relative;
  z-index: 1;
  background: var(--bg);
  transition: transform 0.18s ease;
  touch-action: pan-y;
}

.scan-frame {
  position: relative;
  margin: 20px auto 8px;
  width: min(78vw, 320px);
  aspect-ratio: 1;
  border-radius: 18px;
  overflow: hidden;
  background: #000;
}

.scan-frame video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scan-corners {
  position: absolute;
  inset: 12%;
  border: 2px solid rgba(255, 255, 255, 0.85);
  border-radius: 14px;
  box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.22);
}

.scan-status {
  text-align: center;
  font-size: 13px;
  color: var(--text-2);
  margin: 10px 0 18px;
}

/* 微信式气泡小尾巴 */
.msg .bubble::before {
  content: '';
  position: absolute;
  top: 11px;
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
}

.msg.other .bubble::before {
  left: -5px;
  border-right: 6px solid var(--bubble-other);
}

.msg.mine .bubble::before {
  right: -5px;
  border-left: 6px solid var(--bubble-me);
}

/* 输入栏表情 / 消息操作 / 失败重发 */
.composer-emoji {
  width: 34px;
  height: 38px;
  flex: none;
  color: var(--text-2);
}

.composer-emoji.active {
  color: var(--accent);
}

.emoji-panel {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: calc(56px + var(--safe-bottom));
  z-index: 6;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
  max-height: 220px;
  overflow-y: auto;
  padding: 10px;
  background: var(--card);
  border: 0.5px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.emoji-panel[hidden] {
  display: none;
}

.emoji-panel button {
  height: 36px;
  border: 0;
  background: transparent;
  border-radius: 7px;
  font-size: 23px;
  line-height: 1;
}

.emoji-panel button:active {
  background: var(--bg-2);
}

.msg .bubble {
  -webkit-touch-callout: none;
  user-select: none;
}

.msg.failed .bubble {
  box-shadow: inset 0 0 0 1px rgba(230, 60, 80, 0.45);
}

.msg-retry {
  width: 23px;
  height: 23px;
  margin-top: 4px;
  border: 0;
  border-radius: 50%;
  background: #e5484d;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  line-height: 23px;
  padding: 0;
}

/* 记忆与关系时间线：样式在 forms.css（与 Web 共用） */

/* 请求进行中：防连点 */
.is-busy { opacity: 0.55; pointer-events: none; cursor: progress; }

/* ---------------------------------------------------------------- 简约页面（添加好友 / 设置 / 发朋友圈） */

/* 按钮做的行默认不会撑满，分隔线只画到文字宽度：统一撑满 */
button.field,
label.field {
  width: 100%;
}

.simple-page .page-body {
  padding: 14px 0 calc(32px + var(--safe-bottom));
}

.simple-page .field .field-label {
  min-width: 0;
}

.simple-page .field.stacked {
  display: block;
  padding: 14px 16px;
}

.simple-page .field.stacked .field-label {
  display: block;
  margin-bottom: 8px;
  font-size: 15px;
  color: var(--text);
}

.simple-page .field.stacked textarea {
  min-height: 64px;
  resize: none;
}

.simple-page .field.danger-row {
  justify-content: center;
  color: var(--red);
  font-weight: 500;
}

/* 卡片、表单行、开关、分段切换、标签按钮、可换头像的样式在 css/forms.css（与 Web 共用） */

/* 搜索行 */
.simple-page .search-field {
  gap: 10px;
  color: var(--text-3);
}

.simple-page .search-field input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: none;
  font-size: 16px;
  color: var(--text);
}

.simple-actions {
  padding: 4px 16px;
}

/* ---------------------------------------------------------------- 简约卡片：列表 / 菜单 / 成员（通讯录、聊天列表、我、资料、群设置…） */

/* 原来有几处用了 var(--card)，但从没定义过，背景是透明的 */
:root {
  --card: var(--bg-2);
}

.simple-page .search-bar {
  margin: 0 16px 14px;
  height: 40px;
  border-radius: 12px;
  background: var(--bg-2);
}

.simple-page .section-head {
  padding: 6px 20px 8px;
  font-size: 13px;
  font-weight: 500;
}

.simple-page .list-group {
  margin: 0 16px 12px;
  border: 0;
  border-radius: 14px;
}

.simple-page .list-row {
  min-height: 62px;
  padding: 10px 16px;
  border-bottom: 0;
}

/* 分隔线从头像右侧开始（16 内边距 + 44 头像 + 12 间距） */
.simple-page .list-row + .list-row::before {
  content: '';
  position: absolute;
  top: 0;
  left: 72px;
  right: 0;
  border-top: 0.5px solid var(--line);
}

/* 聊天列表：整个列表是一张卡片，左滑操作被卡片圆角裁住 */
.simple-page #chat-list:not(:empty) {
  margin: 0 16px 12px;
  border-radius: 14px;
  overflow: hidden;
  background: var(--bg-2);
}

.simple-page .chat-row {
  background: var(--bg-2);
}

.simple-page .swipe-row + .swipe-row .chat-row::before {
  content: '';
  position: absolute;
  top: 0;
  left: 76px;
  right: 0;
  border-top: 0.5px solid var(--line);
}

/* 「我」页的菜单 */
.simple-page .menu-row {
  position: relative;
  width: 100%;
  min-height: 52px;
  padding: 0 16px;
  text-align: left;
  border-bottom: 0;
}

.simple-page .menu-row + .menu-row::before {
  content: '';
  position: absolute;
  top: 0;
  left: 54px;
  right: 0;
  border-top: 0.5px solid var(--line);
}

.simple-page .self-card {
  margin: 0 16px 12px;
  border: 0;
  border-radius: 16px;
  background: var(--bg-2);
}

.simple-page .member-grid {
  margin: 0 16px 12px;
  border-radius: 14px;
}

.simple-page .memory-head {
  padding: 0 16px 12px;
}

.simple-page .empty {
  padding: 56px 24px;
}

/* 朋友圈列表：App 里铺满屏幕、白底 */
.moment-feed {
  background: var(--bg-2);
}
