:root {
  --bg: #0e1621;
  --shell: #0b1016;
  --panel: #17212b;
  --panel-2: #1e2c38;
  --line: #242f3d;
  --text: #f5f5f5;
  --muted: #8b9aab;
  --blue: #2aabee;
  --blue-2: #229ed9;
  --green: #4fae4e;
  --bubble-me: #2b5278;
  --bubble-them: #182533;
  --danger: #e53935;
  --radius: 16px;
  --safe-bottom: 12px;
  --profile-top: #1d3a4f;
  --chat-bg: #17212b;
  --chat-wash: none;
  --kb: #1c2833;
  --key: #3a4a58;
  --key-func: #2a3844;
  --key-func-text: #d5e0ea;
  --stamp: #9bb4c9;
  --stamp-read: #6ab3f3;
}

html[data-theme="light"] {
  --bg: #ffffff;
  --shell: #dbe3e8;
  --panel: #ffffff;
  --panel-2: #eef2f5;
  --line: #d7dfe6;
  --text: #222222;
  --muted: #7a868f;
  --bubble-me: #eeffde;
  --bubble-them: #ffffff;
  --profile-top: #8ec8e8;
  --chat-bg: #89c5ef;
  --chat-wash: none;
  --kb: #d4d7dc;
  --key: #ffffff;
  --key-func: #b4bac2;
  --key-func-text: #333333;
  --stamp: #6a7d8a;
  --stamp-read: #4fae4e;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
}

body {
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--shell);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
}

.phone {
  width: min(430px, 100vw);
  height: min(900px, 100vh);
  background: var(--bg);
  position: relative;
  overflow: hidden;
  box-shadow: 0 20px 80px rgba(0, 0, 0, 0.45);
}

#app {
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* 原生相机：整页透明，露出下方 TextureView 预览 */
html.native-cam-on,
html.native-cam-on body,
html.native-cam-on .phone,
html.native-cam-on #app {
  background: transparent !important;
  background-color: transparent !important;
}

#app.app-boot {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
}

.app-splash {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px;
  user-select: none;
  width: 100%;
  min-height: 100%;
  background: #ffffff;
}

.app-splash-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(42, 171, 238, 0.18);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: app-splash-spin 0.85s linear infinite;
}

.auth-busy-mask {
  position: absolute;
  inset: 0;
  z-index: 220;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.55);
  pointer-events: all;
}

.auth-busy-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(42, 171, 238, 0.2);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: app-splash-spin 0.75s linear infinite;
  will-change: transform;
}

.app-splash-text {
  font-size: 14px;
  color: #7a868f;
  letter-spacing: 0.06em;
}

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

button,
input,
textarea {
  font-family: inherit;
}

button {
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
}

.topbar {
  height: 56px;
  background: var(--panel);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--line);
}

.topbar h1 {
  font-size: 18px;
  font-weight: 650;
  flex: 1;
  text-align: center;
}

.topbar-actions {
  display: flex;
  gap: 2px;
}

.peer-hit {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  padding: 4px 8px 4px 4px;
  border-radius: 10px;
}

.peer-hit:hover {
  background: var(--panel-2);
}

.avatar.sm {
  width: 36px;
  height: 36px;
  font-size: 14px;
}

.cell-hint {
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
  margin-top: 3px;
}

.switch {
  width: 42px;
  height: 24px;
  border-radius: 12px;
  background: #3d4c5a;
  position: relative;
  flex-shrink: 0;
}

.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
}

.switch.on {
  background: var(--blue);
}

.switch.on::after {
  left: 20px;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 22px;
  color: var(--blue);
}

.icon-btn:hover {
  background: var(--panel-2);
}

.tabs {
  height: 64px;
  background: var(--panel);
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  border-top: 1px solid var(--line);
  flex-shrink: 0;
  padding-bottom: var(--safe-bottom);
}

.tabs.tabs-4 {
  grid-template-columns: 1fr 1fr 1fr 1fr;
}

.remote-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  /* 不要 min-height:100%，否则会撑满整屏把底栏顶出 */
  min-height: 0;
  box-sizing: border-box;
}

.remote-panel {
  padding: 12px 28px 28px;
  max-width: 340px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}

.remote-panel-hint {
  margin: 0 0 28px;
  text-align: center;
  color: var(--muted);
  font-size: 15px;
  letter-spacing: 0.02em;
}

.remote-gear-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px 26px;
  justify-items: center;
}

.remote-gear-btn {
  width: 76px;
  height: 76px;
  padding: 0;
  border: 0;
  border-radius: 18px;
  color: #1a1a1a;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72) 0%, rgba(255, 255, 255, 0) 42%),
    linear-gradient(160deg, #f7f8fa 0%, #e4e7ec 48%, #d5dae2 100%);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9) inset,
    0 -1px 0 rgba(0, 0, 0, 0.06) inset,
    0 8px 18px rgba(15, 23, 42, 0.14),
    0 2px 4px rgba(15, 23, 42, 0.08);
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}

.remote-gear-btn::after {
  content: "";
  position: absolute;
  inset: 1px 1px auto 1px;
  height: 42%;
  border-radius: 16px 16px 40% 40%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0));
  pointer-events: none;
}

.remote-gear-btn:active {
  transform: scale(0.94);
  filter: brightness(0.97);
}

.remote-gear-btn.on {
  color: #fff;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.38) 0%, rgba(255, 255, 255, 0) 40%),
    linear-gradient(160deg, #5ec8f7 0%, #2aabee 46%, #1a8fd0 100%);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.45) inset,
    0 -1px 0 rgba(0, 40, 80, 0.18) inset,
    0 10px 22px rgba(42, 171, 238, 0.38),
    0 2px 6px rgba(15, 23, 42, 0.12);
}

html:not([data-theme="light"]) .remote-gear-btn {
  color: #f3f6fa;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.16) 0%, rgba(255, 255, 255, 0) 42%),
    linear-gradient(160deg, #3a4a58 0%, #2a3844 50%, #1e2a35 100%);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.12) inset,
    0 -1px 0 rgba(0, 0, 0, 0.35) inset,
    0 10px 22px rgba(0, 0, 0, 0.45),
    0 2px 4px rgba(0, 0, 0, 0.3);
}

html:not([data-theme="light"]) .remote-gear-btn.on {
  color: #fff;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.28) 0%, rgba(255, 255, 255, 0) 40%),
    linear-gradient(160deg, #4fc0f5 0%, #2aabee 48%, #1780bd 100%);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.28) inset,
    0 -1px 0 rgba(0, 0, 0, 0.25) inset,
    0 10px 24px rgba(42, 171, 238, 0.35),
    0 2px 6px rgba(0, 0, 0, 0.35);
}

.tab {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--muted);
  font-size: 11px;
}

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

.tab .ico {
  width: 24px;
  height: 24px;
  display: block;
}

.icon-btn .ico {
  width: 22px;
  height: 22px;
  display: block;
}

.page {
  flex: 1;
  overflow-y: auto;
  background: var(--bg);
}

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.row:active {
  background: var(--panel-2);
}

.avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: #65aadd;
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  overflow: hidden;
}

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

.avatar-tap {
  border: 0;
  padding: 0;
  margin: 0;
  background: transparent;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.avatar-tap .avatar {
  pointer-events: none;
}

.meta {
  flex: 1;
  min-width: 0;
}

.name {
  font-size: 16px;
  font-weight: 600;
}

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

.time {
  color: var(--muted);
  font-size: 12px;
  align-self: flex-start;
  margin-top: 4px;
}

.row-end {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex-shrink: 0;
  min-width: 36px;
}

.row-end .time {
  margin-top: 2px;
  align-self: flex-end;
}

.unread-badge {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: #e53935;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
  box-sizing: border-box;
}

.unread-badge.is-muted {
  background: #8b98a8;
  color: #fff;
}

.chat-mute-ico {
  display: inline-flex;
  align-items: center;
  vertical-align: -3px;
  margin-left: 6px;
  color: #8795a6;
  opacity: 0.95;
  line-height: 0;
}

.chat-mute-ico .chat-mute-svg {
  display: block;
}

.tab-unread {
  position: absolute;
  top: 2px;
  right: calc(50% - 22px);
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: #e53935;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}

.tab-unread.is-muted {
  background: #8b98a8;
}

.empty {
  padding: 64px 24px;
  text-align: center;
  color: var(--muted);
}

.empty h3 {
  color: var(--text);
  margin-bottom: 8px;
}

.badge {
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  background: var(--green);
  color: #fff;
  font-size: 11px;
  display: grid;
  place-items: center;
  padding: 0 6px;
}

.chat-page {
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
}

.chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px 8px;
  background-color: var(--chat-bg);
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center top;
}

.bubble {
  max-width: 78%;
  padding: 8px 10px;
  border-radius: 12px;
  margin-bottom: 6px;
  line-height: 1.4;
  font-size: 15px;
  clear: both;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.bubble.me {
  background: var(--bubble-me);
  float: right;
  border-bottom-right-radius: 4px;
}

.bubble.them {
  background: var(--bubble-them);
  float: left;
  border-bottom-left-radius: 4px;
}

html[data-theme="light"] .bubble.them {
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.08);
}

.bubble .stamp {
  display: block;
  text-align: right;
  font-size: 11px;
  color: var(--stamp);
  margin-top: 4px;
}

.bubble .stamp i {
  font-style: normal;
}

.bubble .stamp i.sent {
  color: var(--stamp);
}

.bubble .stamp i.read {
  color: var(--stamp-read);
}

.fake-input {
  flex: 1;
  min-height: 40px;
  background: var(--panel-2);
  border: 0;
  color: var(--text);
  border-radius: 20px;
  padding: 10px 14px;
  outline: none;
  font-size: 15px;
  line-height: 1.35;
}

.fake-input::placeholder {
  color: var(--muted);
}

.composer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--panel);
  border-top: 1px solid var(--line);
}

.send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-size: 18px;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  tap-highlight-color: transparent;
  outline: none;
  user-select: none;
  -webkit-user-select: none;
}

.send:active,
.send:focus {
  background: var(--blue);
  opacity: 1;
  filter: none;
  transform: none;
}

.voice-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  tap-highlight-color: transparent;
  outline: none;
  border: none;
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
}

.voice-btn:active,
.voice-btn:focus,
.voice-btn.is-recording {
  background: var(--blue);
  opacity: 1;
  filter: none;
  /* 不放大/不高亮，避免按下闪一下 */
  transform: none;
  box-shadow: none;
}

.voice-btn .ico {
  width: 20px;
  height: 20px;
  pointer-events: none;
}

.voice-mask {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  top: 0;
  z-index: 25;
  background: rgba(0, 0, 0, 0.28);
  display: flex;
  align-items: flex-end;
  justify-content: stretch;
  pointer-events: none;
}

.voice-mask.cancel {
  background: rgba(180, 40, 40, 0.22);
}

.voice-dock {
  position: relative;
  width: 100%;
  height: 64px;
  padding: 0 16px 10px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--panel);
  border-top: 1px solid var(--line);
  box-sizing: border-box;
}

.voice-dock.cancel {
  background: #3a1a1a;
  border-top-color: rgba(255, 80, 80, 0.35);
}

.voice-slide-hint {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 14px;
  min-width: 0;
}

.voice-dock.cancel .voice-slide-hint {
  color: #ff8a80;
}

.voice-slide-arrow {
  font-size: 22px;
  line-height: 1;
  opacity: 0.85;
  animation: voice-slide-pulse 1s ease-in-out infinite;
}

@keyframes voice-slide-pulse {
  0%,
  100% {
    transform: translateX(0);
    opacity: 0.55;
  }
  50% {
    transform: translateX(-4px);
    opacity: 1;
  }
}

.voice-rec-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.voice-dock.cancel .voice-rec-meta {
  color: #ffcdd2;
}

.voice-rec-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #e53935;
  box-shadow: 0 0 0 0 rgba(229, 57, 53, 0.45);
  animation: voice-dot-blink 1s ease-in-out infinite;
}

.voice-dock.cancel .voice-rec-dot {
  background: #ff5252;
}

@keyframes voice-dot-blink {
  0%,
  100% {
    opacity: 1;
    box-shadow: 0 0 0 0 rgba(229, 57, 53, 0.4);
  }
  50% {
    opacity: 0.45;
    box-shadow: 0 0 0 6px rgba(229, 57, 53, 0);
  }
}

.voice-mic-orb {
  width: 52px;
  height: 52px;
  margin-left: 4px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transform-origin: center center;
  transition: transform 0.08s linear, background 0.15s ease;
}

.voice-dock.cancel .voice-mic-orb {
  background: #e53935;
}

.voice-mic-orb.live {
  animation: none;
}

.voice-mic-orb .ico {
  width: 24px;
  height: 24px;
  display: block;
}

.bubble.voice {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 120px;
}

.voice-play {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.12);
  color: inherit;
  display: grid;
  place-items: center;
  font-size: 12px;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
}

.voice-play .ico {
  width: 14px;
  height: 14px;
}

.voice-play.playing {
  background: rgba(0, 0, 0, 0.2);
}

.voice-wave {
  flex: 1;
  height: 18px;
  min-width: 48px;
  border-radius: 9px;
  background: repeating-linear-gradient(
    90deg,
    currentColor 0 2px,
    transparent 2px 6px
  );
  opacity: 0.35;
}

.voice-sec {
  font-size: 13px;
  opacity: 0.85;
}

.bubble.voice .stamp {
  width: 100%;
}

.attach-btn {
  width: 36px;
  height: 36px;
  font-size: 20px;
  flex-shrink: 0;
  color: var(--muted);
  display: grid;
  place-items: center;
  cursor: pointer;
}

.cam-screen {
  position: absolute;
  inset: 0;
  z-index: 40;
  background: #000;
}

.cam-screen.cam-native {
  background: transparent;
}

.cam-review-screen {
  background: #000;
}

.cam-review-screen .cam-freeze-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* 始终盖在 video 上，直到确认已在播再隐藏，挡住系统大播放键 */
  z-index: 5;
  background: #000;
  pointer-events: none;
  /* 压住 Android WebView 里带 transform 的 video 合成层 */
  transform: translateZ(1px);
  -webkit-transform: translateZ(1px);
}

.cam-review-screen .cam-freeze-frame.is-hidden {
  opacity: 0;
  visibility: hidden;
  z-index: 0;
  transform: none;
  -webkit-transform: none;
}

.cam-spinner-wrap {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.18);
  pointer-events: none;
  transform: translateZ(2px);
  -webkit-transform: translateZ(2px);
}

.cam-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.28);
  border-top-color: #fff;
  border-radius: 50%;
  animation: cam-spin 0.75s linear infinite;
}

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

.cam-freeze {
  position: absolute;
  inset: 0;
  background: #000;
  z-index: 1;
  pointer-events: none;
}

.cam-freeze.hidden {
  opacity: 0;
  visibility: hidden;
}

.cam-screen video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}

.cam-screen video.cam-live-video {
  opacity: 0;
}

.cam-screen video.cam-live-video.is-live {
  opacity: 1;
}

.cam-screen video.mirror {
  transform: scaleX(-1);
}

.cam-screen video::-webkit-media-controls,
.cam-screen video::-webkit-media-controls-start-playback-button,
.cam-screen video::-webkit-media-controls-overlay-play-button {
  display: none !important;
  opacity: 0 !important;
  -webkit-appearance: none !important;
}

.cam-close,
.cam-side,
.cam-shutter,
.cam-review-btn {
  -webkit-tap-highlight-color: transparent;
  tap-highlight-color: transparent;
  outline: none;
  -webkit-touch-callout: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
}

.cam-close {
  position: absolute;
  top: 14px;
  left: 12px;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  font-size: 18px;
  z-index: 2;
}

.cam-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 28px;
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 2;
  user-select: none;
  -webkit-user-select: none;
}

.cam-shutter {
  width: 72px;
  height: 72px;
  border: none;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.25);
  touch-action: none;
}

.cam-shutter.recording {
  background: #e53935;
  box-shadow: 0 0 0 6px rgba(229, 57, 53, 0.35);
  transform: scale(0.88);
}

.cam-hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 118px;
  text-align: center;
  color: rgba(255, 255, 255, 0.88);
  font-size: 13px;
  z-index: 2;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}

.cam-review-screen .cam-review-media {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  position: absolute;
  inset: 0;
  z-index: 0;
  background: #000;
}

.cam-review-screen .cam-review-video {
  /* 冻帧+转圈期间彻底藏住，避免 WebView 大播放键透出（前置镜像 transform 更容易穿层） */
  opacity: 0;
  visibility: hidden;
  z-index: 1;
  pointer-events: none;
}

.cam-review-screen .cam-review-video.is-ready {
  opacity: 1;
  visibility: visible;
  z-index: 2;
}

.cam-review-screen .cam-review-video.media-mirror.is-ready {
  transform: scaleX(-1);
  -webkit-transform: scaleX(-1);
}

.cam-review-screen video::-webkit-media-controls,
.cam-review-screen video::-webkit-media-controls-enclosure,
.cam-review-screen video::-webkit-media-controls-start-playback-button,
.cam-review-screen video::-webkit-media-controls-overlay-play-button,
.cam-review-screen video::-webkit-media-controls-panel,
.cam-review-screen video::-webkit-media-controls-overlay-enclosure {
  display: none !important;
  -webkit-appearance: none !important;
  opacity: 0 !important;
  pointer-events: none !important;
  width: 0 !important;
  height: 0 !important;
  max-width: 0 !important;
  max-height: 0 !important;
}

.cam-review-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 56px;
  display: flex;
  justify-content: space-evenly;
  gap: 16px;
  padding: 0 24px;
  z-index: 7;
}

.cam-review-btn {
  min-width: 120px;
  height: 46px;
  border-radius: 24px;
  font-size: 16px;
  font-weight: 600;
  background: #2aabee;
  color: #fff;
  border: none;
}

.cam-review-btn:disabled {
  opacity: 0.55;
}

.cam-side {
  width: 72px;
  height: 44px;
  border: none;
  background: transparent;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.cam-side:disabled {
  opacity: 0.4;
}

.cam-screen,
.cam-screen * {
  -webkit-tap-highlight-color: transparent;
}

.bubble.photo {
  padding: 0;
  max-width: 72%;
  background: transparent;
  box-shadow: none;
  overflow: visible;
}

html[data-theme="light"] .bubble.photo.them {
  box-shadow: none;
}

.bubble.photo .media-frame {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: 12px;
  background: #111;
  line-height: 0;
}

.bubble.photo.me .media-frame {
  border-bottom-right-radius: 4px;
}

.bubble.photo.them .media-frame {
  border-bottom-left-radius: 4px;
}

.bubble.photo img,
.bubble.photo video {
  display: block;
  width: 100%;
  max-width: 100%;
  max-height: 320px;
  object-fit: cover;
  border-radius: 0;
  background: #111;
  vertical-align: top;
}

.bubble.photo .lazy-chat-media {
  min-height: 140px;
  background: #1a1a1a;
}

.chat-load-earlier {
  display: block;
  width: calc(100% - 24px);
  margin: 10px 12px 14px;
  padding: 8px 12px;
  border: none;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.22);
  color: rgba(255, 255, 255, 0.88);
  font-size: 13px;
  cursor: pointer;
}

html[data-theme="light"] .chat-load-earlier {
  background: rgba(0, 0, 0, 0.06);
  color: #444;
}

.bubble.photo video {
  pointer-events: auto;
}

.bubble.photo .media-frame > .stamp {
  position: absolute;
  right: 8px;
  bottom: 6px;
  margin: 0;
  z-index: 3;
  color: rgba(255, 255, 255, 0.95);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
  pointer-events: none;
}

.bubble.photo .media-frame > .stamp i.read,
.bubble.photo .media-frame > .stamp i.sent {
  color: rgba(255, 255, 255, 0.92);
}

.bubble.video .vid-play-btn {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 52px;
  height: 52px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.45);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  z-index: 2;
  cursor: pointer;
  display: grid;
  place-items: center;
  -webkit-tap-highlight-color: transparent;
}

/* 封面撑开竖屏气泡；video 绝对定位，避免横向编码把气泡撑成横屏 */
.bubble.video .media-frame {
  position: relative;
  overflow: hidden;
  width: 100%;
}

.bubble.video .chat-vid-cover {
  position: relative;
  display: block;
  width: 100%;
  height: auto;
  max-height: 320px;
  object-fit: cover;
  z-index: 1;
  pointer-events: auto;
  background: #111;
  vertical-align: top;
}

.bubble.video .chat-vid-cover-blank {
  width: 100%;
  aspect-ratio: 3 / 4;
  max-height: 320px;
  background: #111;
}

.bubble.video .chat-vid-cover.is-hidden {
  opacity: 0;
  /* 仍占位，播放中保持竖屏比例 */
  pointer-events: none;
}

.bubble.video video.chat-vid {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: cover;
  z-index: 0;
  background: #111;
}

.bubble.video video.media-mirror {
  transform: scaleX(-1);
  -webkit-transform: scaleX(-1);
}

.bubble.video .media-frame.is-playing video.chat-vid {
  z-index: 1;
}

.bubble.video .vid-play-btn::before {
  content: "";
  display: block;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 9px 0 9px 16px;
  border-color: transparent transparent transparent #fff;
  position: relative;
  left: 2px;
}

.bubble.video .media-frame.is-playing .vid-play-btn {
  opacity: 0;
  pointer-events: none;
}

.bubble.video video::-webkit-media-controls,
.bubble.video video::-webkit-media-controls-enclosure,
.bubble.video video::-webkit-media-controls-start-playback-button,
.bubble.video video::-webkit-media-controls-overlay-play-button,
.bubble.video video::-webkit-media-controls-panel {
  display: none !important;
  opacity: 0 !important;
  width: 0 !important;
  height: 0 !important;
  -webkit-appearance: none !important;
  pointer-events: none !important;
}

.bubble.video .vid-dur {
  position: absolute;
  left: 8px;
  bottom: 6px;
  z-index: 3;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 12px;
  line-height: 1.2;
  pointer-events: none;
}

.media-spinner {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 5;
  width: 34px;
  height: 34px;
  margin: -17px 0 0 -17px;
  border: 3px solid rgba(255, 255, 255, 0.28);
  border-top-color: #fff;
  border-radius: 50%;
  animation: media-spin 0.75s linear infinite;
  pointer-events: none;
}

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

.media-frame.is-loading .vid-play-btn,
.media-frame.is-uploading .vid-play-btn {
  opacity: 0 !important;
  pointer-events: none !important;
}

.media-frame.is-uploading .media-spinner {
  border-top-color: #7ec8ff;
}

.bubble.photo .photo-cap {
  margin-top: 0;
  padding: 8px 10px 6px;
  font-size: 14px;
  line-height: 1.35;
  white-space: pre-wrap;
  border-radius: 0 0 12px 12px;
}

.bubble.photo.me .photo-cap {
  background: var(--bubble-me);
  border-bottom-right-radius: 4px;
}

.bubble.photo.them .photo-cap {
  background: var(--bubble-them);
  border-bottom-left-radius: 4px;
}

.bubble.call-log {
  background: var(--panel-2);
  color: var(--muted);
  font-size: 13px;
  max-width: 86%;
  float: none;
  margin: 8px auto;
  text-align: center;
  clear: both;
}

.bubble .quote {
  border-left: 3px solid var(--blue);
  padding: 4px 8px;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
  background: rgba(0, 0, 0, 0.12);
  border-radius: 0 8px 8px 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.bubble.msg-flash {
  animation: msg-flash-pulse 1.2s ease;
}

@keyframes msg-flash-pulse {
  0%,
  100% {
    outline: 2px solid transparent;
  }
  20%,
  70% {
    outline: 2px solid var(--blue);
    outline-offset: 2px;
  }
}

.copy-toast {
  position: fixed;
  left: 50%;
  bottom: 88px;
  transform: translateX(-50%);
  z-index: 200;
  padding: 8px 14px;
  border-radius: 16px;
  background: rgba(20, 28, 36, 0.88);
  color: #fff;
  font-size: 13px;
  pointer-events: none;
}

.media-viewer {
  position: absolute;
  inset: 0;
  z-index: 60;
  background: #000;
  display: flex;
  flex-direction: column;
}

.media-viewer-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 3;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  padding-top: max(10px, env(safe-area-inset-top, 10px));
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.55), transparent);
  pointer-events: none;
}

.media-viewer-icon-btn {
  pointer-events: auto;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  font-size: 18px;
  line-height: 1;
  display: grid;
  place-items: center;
  -webkit-tap-highlight-color: transparent;
}

.media-viewer-stage {
  flex: 1;
  display: grid;
  place-items: center;
  position: relative;
  min-height: 0;
}

.media-viewer-media {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  background: #000;
  user-select: none;
  -webkit-user-select: none;
}

.media-viewer-img {
  cursor: pointer;
}

.media-viewer-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.media-viewer-cover {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  z-index: 1;
  background: #000;
  pointer-events: auto;
}

.media-viewer-cover-blank {
  display: block;
}

.media-viewer-cover.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.media-viewer-video.media-mirror {
  transform: scaleX(-1);
  -webkit-transform: scaleX(-1);
}

.media-viewer video::-webkit-media-controls,
.media-viewer video::-webkit-media-controls-enclosure,
.media-viewer video::-webkit-media-controls-start-playback-button,
.media-viewer video::-webkit-media-controls-overlay-play-button,
.media-viewer video::-webkit-media-controls-panel {
  display: none !important;
  opacity: 0 !important;
  width: 0 !important;
  height: 0 !important;
  -webkit-appearance: none !important;
  pointer-events: none !important;
}

.media-viewer-play {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 64px;
  height: 64px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.45);
  z-index: 3;
  display: grid;
  place-items: center;
  -webkit-tap-highlight-color: transparent;
}

.media-viewer-play::before {
  content: "";
  display: block;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 11px 0 11px 18px;
  border-color: transparent transparent transparent #fff;
  position: relative;
  left: 3px;
}

.media-viewer.is-playing .media-viewer-play {
  opacity: 0;
  pointer-events: none;
}

.media-viewer-toast {
  position: absolute;
  left: 50%;
  bottom: 48px;
  transform: translateX(-50%);
  z-index: 4;
  padding: 8px 14px;
  border-radius: 16px;
  background: rgba(20, 28, 36, 0.88);
  color: #fff;
  font-size: 13px;
  pointer-events: none;
}

.media-viewer-toast[hidden] {
  display: none !important;
}

.media-mirror {
  transform: scaleX(-1);
  -webkit-transform: scaleX(-1);
}

.bubble .zh {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--muted);
  font-size: 14px;
}

html[data-theme="light"] .bubble .zh {
  border-top-color: rgba(0, 0, 0, 0.08);
}

.reply-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px 0;
  background: var(--panel);
  border-top: 1px solid var(--line);
}

.reply-bar-text {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  color: var(--muted);
  border-left: 3px solid var(--blue);
  padding: 4px 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.msg-actions button {
  width: 100%;
  text-align: left;
  padding: 14px 4px;
  font-size: 16px;
  border-bottom: 1px solid var(--line);
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
}

.msg-actions button:last-child,
.msg-actions .ghost {
  border-bottom: 0;
}

.msg-actions button.danger {
  color: var(--danger);
}

.kb {
  background: var(--kb);
  padding: 8px 6px 10px;
  flex-shrink: 0;
  user-select: none;
}

.kb-row {
  display: flex;
  justify-content: center;
  gap: 5px;
  margin-bottom: 6px;
}

.key {
  flex: 1;
  min-height: 42px;
  border-radius: 6px;
  background: var(--key);
  color: var(--text);
  font-size: 16px;
  display: grid;
  place-items: center;
}

.key.wide {
  flex: 1.4;
}

.key.space {
  flex: 4.2;
}

.key.func {
  background: var(--key-func);
  color: var(--key-func-text);
  font-size: 13px;
}

.key:active {
  filter: brightness(1.2);
}

.call-screen {
  position: absolute;
  inset: 0;
  z-index: 30;
  background: #0e1621;
  display: flex;
  flex-direction: column;
  align-items: center;
  color: #fff;
}

.call-screen.video {
  background: #0e1621;
}

.call-bg {
  position: absolute;
  inset: 0;
  filter: blur(24px) brightness(0.45);
  transform: scale(1.15);
  background-size: cover;
  background-position: center;
}

.call-video-blank {
  position: absolute;
  inset: 0;
  background: #0e1621;
  z-index: 0;
}

.call-remote-video,
.call-local-video {
  object-fit: cover;
  background: #0e1621;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.call-remote-video.ready,
.call-local-video.ready {
  opacity: 1;
}

/* 隐藏 WebView 默认大播放按钮（虚拟相机流未就绪时会露出来） */
.call-screen video::-webkit-media-controls,
.call-screen video::-webkit-media-controls-enclosure,
.call-screen video::-webkit-media-controls-start-playback-button,
.call-screen video::-webkit-media-controls-overlay-play-button {
  display: none !important;
  -webkit-appearance: none !important;
  opacity: 0 !important;
  width: 0 !important;
  height: 0 !important;
  pointer-events: none !important;
}

.call-remote-video.is-main,
.call-local-video.is-main {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  border: 0;
  border-radius: 0;
  right: auto;
  top: auto;
}

.call-remote-video.is-pip,
.call-local-video.is-pip {
  position: absolute;
  right: 12px;
  top: 64px;
  width: 110px;
  height: 150px;
  border-radius: 12px;
  z-index: 4;
  border: 1px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* canvas 预览虚拟相机时同样套用 pip/main */
.call-screen canvas.call-local-video.is-pip,
.call-screen canvas.call-local-video.is-main {
  display: block;
}

.call-info {
  position: relative;
  z-index: 2;
  text-align: center;
  padding-top: 88px;
}

.call-info .avatar.xl {
  width: 120px;
  height: 120px;
  margin: 0 auto 16px;
  font-size: 48px;
  box-shadow: 0 0 0 8px rgba(42, 171, 238, 0.15);
}

.call-info h2 {
  font-size: 26px;
  font-weight: 600;
}

.call-status {
  margin-top: 8px;
  color: #c5d4e0;
}

.call-actions {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 36px;
  z-index: 3;
  display: flex;
  justify-content: center;
  gap: 22px;
}

.call-act {
  width: 62px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #dbe7f0;
}

.call-act i {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 22px;
  background: rgba(255, 255, 255, 0.14);
}

.call-act i .ico {
  width: 26px;
  height: 26px;
}

.call-act.hang i .ico {
  transform: rotate(135deg);
}

.attach-btn .ico,
.key .ico {
  width: 22px;
  height: 22px;
  display: block;
}

.call-act.hang i {
  background: #e53935;
}

.call-act.answer i {
  background: #4caf50;
}

.call-act.on i {
  background: #fff;
  color: #111;
}

.call-act.recording i,
.call-act.on.recording i {
  background: #e53935;
  color: #fff;
}

.pulse {
  animation: pulse 1.6s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(42, 171, 238, 0.45);
  }
  70% {
    box-shadow: 0 0 0 18px rgba(42, 171, 238, 0);
  }
}

.profile {
  padding: 28px 16px 20px;
  text-align: center;
  background: linear-gradient(180deg, var(--profile-top) 0%, var(--bg) 100%);
}

.page.me-page {
  background: linear-gradient(180deg, var(--profile-top) 0%, var(--bg) 38%);
}

.page.me-page .profile {
  background: transparent;
  padding-top: 44px;
}

.profile .avatar.lg,
.avatar.lg {
  width: 108px;
  height: 108px;
  margin: 0 auto 12px;
  font-size: 42px;
}

.avatar.xl {
  width: 120px;
  height: 120px;
  font-size: 48px;
}

.profile .id {
  color: var(--blue);
  margin-top: 4px;
}

.card {
  margin: 12px;
  background: var(--panel);
  border-radius: var(--radius);
  overflow: hidden;
}

.cell {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

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

.cell span {
  color: var(--muted);
}

.cell.danger,
.cell.danger div {
  color: var(--danger);
}

.app-lock-cell {
  align-items: center;
}

.app-lock-cell-main {
  flex: 1;
  text-align: left;
  min-width: 0;
}

.app-lock-action {
  flex-shrink: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent, #2aabee);
}

.modal-mask {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: flex-end;
  z-index: 20;
}

.sheet {
  width: 100%;
  background: var(--panel);
  border-radius: 18px 18px 0 0;
  padding: 16px 16px 24px;
}

.sheet h2 {
  font-size: 17px;
  margin-bottom: 12px;
}

.gallery-sheet {
  width: 100%;
  background: var(--panel);
  border-radius: 16px 16px 0 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* 不设 max-height%，避免把网格压成一条条 */
  height: auto;
  max-height: none;
}

.gallery-head {
  display: grid;
  grid-template-columns: 40px 1fr 40px;
  align-items: center;
  padding: 6px 10px;
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}

.gallery-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: var(--text);
  font-size: 16px;
  display: grid;
  place-items: center;
}

.gallery-title {
  text-align: center;
  font-weight: 650;
  font-size: 15px;
}

.gallery-count {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: grid;
  place-items: center;
  justify-self: end;
}

.gallery-grid {
  --gal-cell: calc((100vw - 4px) / 3);
  display: grid;
  grid-template-columns: repeat(3, var(--gal-cell));
  grid-auto-rows: var(--gal-cell);
  gap: 2px;
  padding: 2px;
  background: #0a0f14;
  box-sizing: border-box;
  width: 100%;
  /* 只显示两排：3 列 × 2 行 */
  height: calc(var(--gal-cell) * 2 + 4px);
  overflow-x: hidden;
  overflow-y: auto;
  flex: 0 0 auto;
  -webkit-overflow-scrolling: touch;
}

.gallery-cell {
  position: relative;
  width: var(--gal-cell);
  height: var(--gal-cell);
  overflow: hidden;
  background: #1a222b;
  padding: 0;
  border: 0;
  flex: none;
}

.gallery-cell img,
.gallery-cell video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

.gallery-cell video.mirror {
  transform: scaleX(-1);
}

.gallery-cell.camera-live {
  background: #000;
}

.gallery-cell.camera-live .cam-preview-slot {
  position: absolute;
  inset: 0;
  background: #000;
  overflow: hidden;
}

.gallery-cell.camera-live .cam-preview-slot video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  background: #000;
  pointer-events: none;
}

.gallery-cell.camera-live.is-live .cam-preview-slot video {
  opacity: 1;
}

.gallery-cell.camera-live video::-webkit-media-controls,
.gallery-cell.camera-live video::-webkit-media-controls-start-playback-button,
.gallery-cell.camera-live video::-webkit-media-controls-overlay-play-button {
  display: none !important;
  -webkit-appearance: none;
  opacity: 0 !important;
  pointer-events: none !important;
  width: 0 !important;
  height: 0 !important;
}

.gallery-cell .cam-badge {
  position: absolute;
  right: 6px;
  bottom: 6px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  display: none !important; /* 相册相机格不再显示角标 */
  place-items: center;
  z-index: 1;
}

.gallery-cell .cam-badge .ico {
  width: 14px;
  height: 14px;
}

.gallery-cell .gal-check {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.95);
  background: rgba(0, 0, 0, 0.18);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: grid;
  place-items: center;
  padding: 0;
  line-height: 1;
  z-index: 2;
}

.gallery-cell.on .gal-check {
  background: var(--blue);
  border-color: #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.2);
}

.gallery-cell.is-video .gal-video-dur {
  position: absolute;
  left: 6px;
  bottom: 6px;
  z-index: 1;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 11px;
  line-height: 1.2;
  pointer-events: none;
}

.gallery-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px calc(10px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--line);
  background: var(--panel);
  flex-shrink: 0;
}

.gallery-caption {
  flex: 1;
  min-height: 40px;
  border: 0;
  border-radius: 20px;
  background: var(--panel-2);
  color: var(--text);
  padding: 10px 14px;
  outline: none;
  font-size: 15px;
}

.gallery-caption:disabled {
  opacity: 0.55;
}

.gallery-send-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-size: 18px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
}

.gallery-send-btn:disabled {
  opacity: 0.4;
}

.gal-preview-mask {
  position: absolute;
  inset: 0;
  z-index: 30;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gal-preview-img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  pointer-events: none;
}

.gal-preview-check {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top, 0px));
  right: 14px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.95);
  background: rgba(0, 0, 0, 0.28);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  display: grid;
  place-items: center;
  z-index: 31;
}

.gal-preview-check.on {
  background: var(--blue);
  border-color: #fff;
}

.cam-fallback {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: #fff;
  background: #243040;
  font-size: 13px;
  text-align: center;
  padding: 10px;
  line-height: 1.35;
}

.field {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 10px;
  outline: none;
  resize: none;
}

.field.area {
  min-height: 88px;
  line-height: 1.45;
}

.bio-line {
  color: var(--muted);
  font-size: 14px;
  margin-top: 8px;
  padding: 0 16px;
}

.primary {
  width: 100%;
  background: var(--blue);
  color: #fff;
  border-radius: 12px;
  padding: 12px;
  font-weight: 650;
}

.ghost {
  width: 100%;
  color: var(--muted);
  padding: 12px;
  margin-top: 4px;
}

.hint {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 10px;
}

.setup {
  height: 100%;
  padding: 48px 22px;
  display: flex;
  flex-direction: column;
  position: relative;
}

.success-mask {
  align-items: center;
  justify-content: center;
}

.success-box {
  width: calc(100% - 48px);
  background: var(--panel);
  border-radius: 16px;
  padding: 28px 20px 20px;
  text-align: center;
}

.success-box h2 {
  font-size: 22px;
  margin-bottom: 20px;
}

.perm-desc {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  margin: 0 0 20px;
}

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

.perm-actions .ghost,
.perm-actions .primary {
  margin: 0;
  width: auto;
  flex: 1;
}

.auth-actions {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}

.auth-actions .primary {
  margin: 0;
  flex: 1;
}

.ghost-outline {
  background: transparent;
  border: 1px solid var(--blue);
  color: var(--blue);
}

.setup h1 {
  font-size: 28px;
  margin-bottom: 16px;
}

.setup p {
  color: var(--muted);
  margin-bottom: 24px;
}

.app-lock-screen {
  height: 100%;
  min-height: 100%;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  padding: 32px 24px;
}

.app-lock-ico {
  width: 72px;
  height: 72px;
  color: #8a96a3;
}

.app-lock-unlock-btn {
  min-width: 160px;
  padding: 12px 28px;
}

.a11y-gate {
  height: 100%;
  min-height: 100%;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 22px;
}

.a11y-gate-card {
  width: 100%;
  max-width: 360px;
  text-align: center;
}

.a11y-gate-card h2 {
  font-size: 22px;
  margin-bottom: 12px;
}

.a11y-gate-card .hint {
  color: var(--muted);
  margin-bottom: 22px;
  line-height: 1.5;
}

.file-btn {
  display: block;
  text-align: center;
  background: var(--panel-2);
  padding: 12px;
  border-radius: 12px;
  margin-bottom: 10px;
}

.search {
  margin: 10px 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 12px;
  padding: 12px 14px;
  width: calc(100% - 24px);
  outline: none;
  font-size: 15px;
}

.search::placeholder {
  color: var(--muted);
  opacity: 1;
}

.search:focus {
  border-color: var(--blue);
}

.online {
  width: 10px;
  height: 10px;
  background: var(--green);
  border-radius: 50%;
  border: 2px solid var(--bg);
  position: absolute;
  right: 0;
  bottom: 2px;
}

.avatar-wrap {
  position: relative;
  flex-shrink: 0;
}

html[dir="rtl"] .tabs,
html[dir="rtl"] .topbar,
html[dir="rtl"] .composer,
html[dir="rtl"] .row,
html[dir="rtl"] .cell,
html[dir="rtl"] .peer-hit,
html[dir="rtl"] .call-actions,
html[dir="rtl"] .gallery-head,
html[dir="rtl"] .gallery-foot {
  direction: rtl;
}

html[dir="rtl"] .bubble.me {
  float: left;
}

html[dir="rtl"] .bubble.them {
  float: right;
}

html[dir="rtl"] .online {
  right: auto;
  left: 0;
}

