/* 隐秘模式皮肤：仿即时通讯软件的单聊与列表外观。
   只在 <html data-stealth="1"> 时生效；不引用任何品牌资源，图标为通用聊天气泡。 */

.wx {
  --wx-nav: #ededed;
  --wx-bg: #ededed;
  --wx-line: #d9d9d9;
  --wx-text: #191919;
  --wx-sub: #888888;
  --wx-green: #95ec69;
  --wx-accent: #07c160;
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  /* 关键：高度跟随可视化视口，软键盘弹起时整体收缩，
     导航栏（联系人名）留在顶部，而不是把整页向上顶 */
  height: var(--app-height, 100dvh);
  z-index: 70;
  display: flex;
  flex-direction: column;
  background: var(--wx-bg);
  color: var(--wx-text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei UI",
               "Hiragino Sans GB", sans-serif;
  font-size: 17px;
  line-height: 1.45;
}

/* ------------------------------------------------------------ 深色主题 */
:root[data-stealth-theme="dark"] .wx {
  --wx-nav: #1f1f1f;
  --wx-bg: #111111;
  --wx-line: #2c2c2c;
  --wx-text: #d6d6d6;
  --wx-sub: #7d7d7d;
  --wx-green: #2f6b45;
  --wx-accent: #3eb575;
}

:root[data-stealth-theme="dark"] .wx-list,
:root[data-stealth-theme="dark"] .wx-body.wx-plain,
:root[data-stealth-theme="dark"] .wx-tabbar,
:root[data-stealth-theme="dark"] .wx-input,
:root[data-stealth-theme="dark"] .wx-extras {
  background: #1f1f1f;
}

:root[data-stealth-theme="dark"] .wx-item,
:root[data-stealth-theme="dark"] .wx-cell { border-color: #2c2c2c; }

:root[data-stealth-theme="dark"] .wx-item:active { background: #2b2b2b; }

:root[data-stealth-theme="dark"] .wx-bubble {
  background: #2c2c2c;
  border-color: #333333;
}

:root[data-stealth-theme="dark"] .wx-left .wx-bubble::before { border-right-color: #2c2c2c; }
:root[data-stealth-theme="dark"] .wx-right .wx-bubble::before { border-left-color: var(--wx-green); }

:root[data-stealth-theme="dark"] .wx-input input {
  background: #2c2c2c;
  color: var(--wx-text);
}

:root[data-stealth-theme="dark"] .wx-voice,
:root[data-stealth-theme="dark"] .wx-emoji,
:root[data-stealth-theme="dark"] .wx-plus { color: #b0b0b0; }

:root[data-stealth-theme="dark"] .wx-ava { background: #3a3a3a; }
:root[data-stealth-theme="dark"] .wx-extra span { background: #2c2c2c; border-color: #333333; }
:root[data-stealth-theme="dark"] .wx-time,
:root[data-stealth-theme="dark"] .wx-item-time { color: #6b6b6b; }

/* ------------------------------------------------------------ 顶部栏 */
.wx-nav {
  flex: none;
  position: relative;
  display: flex;
  align-items: center;
  height: calc(env(safe-area-inset-top, 0px) + 46px);
  padding-top: env(safe-area-inset-top, 0px);
  padding-left: 6px;
  padding-right: 10px;
  background: var(--wx-nav);
  border-bottom: 1px solid var(--wx-line);
}

.wx-back,
.wx-more,
.wx-back-space {
  flex: none;
  width: 44px;
  border: 0;
  background: transparent;
  color: var(--wx-text);
  font-size: 26px;
  line-height: 1;
  text-align: center;
  padding: 0;
  cursor: pointer;
}

.wx-back { font-size: 30px; font-weight: 300; }
.wx-more { font-size: 19px; letter-spacing: 1px; }
.wx-back-space { display: inline-block; }

.wx-title {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.wx-name {
  font-size: 17px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.wx-sub {
  font-size: 12px;
  color: var(--wx-sub);
  margin-top: -1px;
}

/* ------------------------------------------------------------ 消息区 */
.wx-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 10px 12px 14px;
  background: var(--wx-bg);
}

.wx-body.wx-plain { padding: 0; background: #ffffff; }

.wx-time {
  text-align: center;
  color: var(--wx-sub);
  font-size: 12px;
  margin: 10px 0 12px;
}

.wx-row {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-bottom: 16px;
}

.wx-right { flex-direction: row-reverse; }

.wx-ava {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 5px;
  object-fit: cover;
  background: #cfcfcf;
}

.wx-ava-text {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 18px;
}

.wx-bubble {
  position: relative;
  max-width: 68%;
  padding: 9px 12px;
  border-radius: 5px;
  background: #ffffff;
  border: 1px solid #e5e5e5;
  word-break: break-word;
  overflow-wrap: break-word;
}

.wx-right .wx-bubble {
  background: var(--wx-green);
  border-color: #86d95e;
}

.wx-left .wx-bubble::before,
.wx-right .wx-bubble::before {
  content: "";
  position: absolute;
  top: 12px;
  width: 0;
  height: 0;
  border: 6px solid transparent;
}

.wx-left .wx-bubble::before {
  left: -11px;
  border-right-color: #ffffff;
  border-left-width: 5px;
}

.wx-right .wx-bubble::before {
  right: -11px;
  border-left-color: var(--wx-green);
  border-right-width: 5px;
}

/* ------------------------------------------------------------ 输入栏 */
.wx-input {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px calc(env(safe-area-inset-bottom, 0px) + 8px);
  background: #f7f7f7;
  border-top: 1px solid var(--wx-line);
}

.wx-voice,
.wx-emoji {
  flex: none;
  width: 30px;
  text-align: center;
  color: #4a4a4a;
  font-size: 20px;
}

.wx-input input {
  flex: 1;
  min-width: 0;
  height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: 4px;
  background: #ffffff;
  font-size: 17px;
  color: var(--wx-text);
  outline: none;
}

.wx-plus,
.wx-send {
  flex: none;
  border: 0;
  background: transparent;
  color: #4a4a4a;
  font-size: 24px;
  width: 34px;
  padding: 0;
  cursor: pointer;
}

.wx-send {
  width: auto;
  min-width: 58px;
  height: 32px;
  padding: 0 14px;
  border-radius: 4px;
  background: var(--wx-accent);
  color: #ffffff;
  font-size: 15px;
}

/* ------------------------------------------------------------ 列表 / 选项卡 */
.wx-list { flex: 1; overflow-y: auto; background: #ffffff; }

.wx-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 14px;
  border-bottom: 1px solid #f0f0f0;
  cursor: pointer;
}

.wx-item:active { background: #ececec; }

.wx-item-main { flex: 1; min-width: 0; }

.wx-item-name {
  font-size: 17px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wx-item-msg {
  font-size: 14px;
  color: var(--wx-sub);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.wx-item-time {
  flex: none;
  align-self: flex-start;
  font-size: 12px;
  color: #b2b2b2;
  padding-top: 3px;
}

.wx-cell {
  padding: 15px 16px;
  border-bottom: 1px solid #f0f0f0;
  font-size: 17px;
}

.wx-empty {
  padding: 40px 16px;
  text-align: center;
  color: var(--wx-sub);
  font-size: 15px;
}

.wx-tabbar {
  flex: none;
  display: flex;
  background: #f7f7f7;
  border-top: 1px solid var(--wx-line);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.wx-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 7px 0 6px;
  border: 0;
  background: transparent;
  color: #7f7f7f;
  font-size: 11px;
  cursor: pointer;
}

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

.wx-tab-dot {
  width: 20px;
  height: 20px;
  border: 1.5px solid currentColor;
  border-radius: 6px;
  opacity: .75;
}

/* 输入栏下方的扩展面板 */
.wx-extras {
  flex: none;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  padding: 14px 12px calc(env(safe-area-inset-bottom, 0px) + 14px);
  background: #f7f7f7;
  border-top: 1px solid var(--wx-line);
}

.wx-extra {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #6b6b6b;
}

.wx-extra span {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: #ffffff;
  border: 1px solid #e5e5e5;
}

/* 桌面浏览器预览时限制宽度 */
@media (min-width: 700px) {
  .wx { left: 50%; right: auto; width: 420px; transform: translateX(-50%);
        box-shadow: 0 0 24px rgba(0, 0, 0, .18); }
}
